#include #define RX 2 // MOSI 0 #define TX 1 // SCK 2 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 void setup() { pinMode(analogPin, INPUT); pinMode(laser, OUTPUT); Serial.begin(9600); Serial.println("HELLO"); } void loop() { if (Serial.available()) { int analogValue = analogRead(analogPin); char MasterCommand = Serial.read(); //char message = "O"; // Serial.println("a"); if(MasterCommand == 'O') { digitalWrite(laser, HIGH); Serial.print("on"); Serial.println(analogValue); } //else{ //Serial.print(MasterCommand); //} } }