Testing out the PPD42 Air Quality Sensor, with an MSP430 Launchpad and graphing the data with GNUplot.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

42 lines
1.1 KiB

/*
Blink
The basic Energia example.
Turns on an LED on for one second, then off for one second, repeatedly.
Change the LED define to blink other LEDs.
Hardware Required:
* LaunchPad with an LED
This example code is in the public domain.
*/
// most launchpads have a red LED
//#define LED RED_LED
//see pins_energia.h for more LED definitions
#define LED GREEN_LED
#define DUSTSENSORPIN 1
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(LED, OUTPUT);
pinMode(DUSTSENSORPIN, INPUT);
Serial.begin(4800);
}
// the loop routine runs over and over again forever:
void loop() {
Serial.println("test");
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
int DustSensorState = digitalRead(DUSTSENSORPIN);
Serial.print("Sensor reads:");
Serial.println(DustSensorState);
}