#include // *** // *** Define the RX and TX pins. Choose any two // *** pins that are unused. Try to avoid D0 (pin 5) // *** and D2 (pin 7) if you plan to use I2C. // *** #define RX 1 // *** D3, Pin 2 #define TX 2 // *** D4, Pin 3 // *** // *** Define the software based serial port. Using the // *** name Serial so that code can be used on other // *** platforms that support hardware based serial. On // *** chips that support the hardware serial, just // *** comment this line. // *** SoftwareSerial Serial(RX, TX); const int analogPin = 3; // pin that the sensor is attached to const int laser = 4; // pin that the LED is attached to //const int threshold = 600; // an arbitrary threshold level that's in the range of the analog input void setup() { // initialize the LED pin as an output: pinMode(laser, OUTPUT); // initialize serial communications: Serial.begin(9600); } void loop() { // read the value of the potentiometer: int analogValue = analogRead(analogPin); digitalWrite(laser, HIGH); // if the analog value is high enough, turn on the LED: // if (analogValue > threshold) { // digitalWrite(ledPin, HIGH); //} else { // digitalWrite(ledPin, LOW); // } // print the analog value: Serial.println(analogValue); delay(1); // delay in between reads for stability }