// These constants won't change. They're used to give names to the pins used: #define R_LIGHT A6 // Analog input pin that the potentiometer is attached to #define C_LED 4 #define INA1 19 #define INB1 41 #define M1 12 #define EN1 18 #define CS1 A7 float sensorValue = 0; // value read from the pot void setup() { // initialize serial communications at 9600 bps: Serial.begin(115200); TCCR1B = TCCR1B & 0b11111000 | 0x01; pinMode(INA1, OUTPUT); pinMode(INB1, OUTPUT); pinMode(EN1, OUTPUT); digitalWrite(INA1, HIGH); digitalWrite(INB1, LOW); digitalWrite(EN1, HIGH); analogWrite(M1, 255); } void loop() { digitalWrite(INA1, HIGH); digitalWrite(INB1, LOW); delay(100); sensorValue = analogRead(R_LIGHT); Serial.print("LIGHT = "); Serial.print(sensorValue); sensorValue = analogRead(CS1)*(5000/1023.)*(5000/2400); //sensorValue = analogRead(CS1)*(5000/1023.); Serial.print(" CURRENT = "); Serial.println(sensorValue); delay(1000); digitalWrite(INA1, LOW); digitalWrite(INB1, LOW); delay(1000); // wait 2 milliseconds before the next loop for the analog-to-digital // converter to settle after the last reading: delay(2); }