#include /* Basic Analogue Input Control - PhotoResistor Input This example reads an analogue value from analogue in pin 1 and then compares this to a set point. If the set point is threshold is crossed, the LED on digital pin 7 is turned on/off. Author: David M. Auld Date: 9th October 2009 */ int photoIn = 0; // photoresistor on Analogue Pin 1 int aiValue = 0; // input value int setPoint = 350; // Trigger value void setup() { DigiUSB.begin(); } void wait_till_newline() { // when there are no characters to read, or the character isn't a newline while (!DigiUSB.available() || DigiUSB.read() != '\n') { // refresh the usb port DigiUSB.refresh(); } } void loop() { //delay(2000); // DigiUSB.begin(); wait_till_newline(); //DigiUSB.refresh(); // Reading temperature or humidity takes about 250 milliseconds! // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) aiValue = analogRead(photoIn); // Read the analogue input value DigiUSB.print("##"); DigiUSB.print(aiValue); DigiUSB.print("@@"); return; }