Last active
January 6, 2016 23:00
-
-
Save hackolite/4a500d5aacb7b352c02f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char val; // variable to receive data from the serial port | |
void setup() { | |
Serial.begin(9600); // start serial communication at 9600bps | |
} | |
void loop() { | |
if( Serial.available() ) // if data is available to read | |
{ | |
val = Serial.read(); // read it and store it in 'val' | |
} | |
if( val == 'd' ) // if 'H' was received | |
{ | |
int mq3_value = analogRead(A0); | |
Serial.print(" {'luminosity': "); | |
Serial.print(mq3_value); | |
Serial.println("}"); | |
delay(500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment