Maker Pro
Maker Pro

Help with Basic Programming

Andyjm

Feb 7, 2014
11
Joined
Feb 7, 2014
Messages
11
Hi all,

I was wondering if anyone can offer some assistance with a very basic Arduino program I'm trying to write. I'm not too familiar with the sketching for this stuff.

I have an MQ2 sensor hooked up to my Mega2560, with a couple LEDs, one green that lights when the sensor level is below 750 and one red when it's above 750. I also have a Sainsmart ST7735 TFT connected up. I can get the LEDs to work no problem, but I'm not sure how I can get the results to print to my TFT instead of the serial monitor. Also, when I try to compile the sketch as it is, I get an error here :

myScreen TFT(cs, dc, reset, scl, sda);

This is the error:

MQ2_Sensor_Attempt_1:18: error: 'myScreen' does not name a type

I've attached a notepad with the code, if anyone has any experience could they point me in the right direction?

Many thanks,

Andy
 

Attachments

  • arduino code.txt
    1.6 KB · Views: 69

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
You assume we know what an mq2 sensor is and a mega thingy me bob and a sainy thingy. Also what is 750, 750 what volts,mili volts, mA.
Can you be a bit more specific please.
Adam
 

Andyjm

Feb 7, 2014
11
Joined
Feb 7, 2014
Messages
11
Apologies for the lack of detail.

The Mega2560 is an Arduino microcontroller PCB. The MQ2 is an Arduino compatible gas sensor that I have connected to one of the analogue inputs on the mega. The Sainsmart ST7735 is a small TFT LCD module that I have connected to the digital input pins on the mega. The 750 refers to the PPM reading from the MQ2 gas sensor that I'm trying to output to the LCD.

I'll set about finding some links to the various parts online.
 
Top