Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int analogInPin = A0;
- int sensorValue = 0;
- int ledR = 5;
- int ledV = 3;
- void setup() {
- Serial.begin(9600);
- pinMode( analogInPin, INPUT);
- pinMode (ledR, OUTPUT);
- pinMode (ledV, OUTPUT);
- }
- void loop() {
- sensorValue = analogRead(analogInPin);
- if (sensorValue<200){
- digitalWrite (ledV,HIGH);
- }
- else{
- digitalWrite (ledV,LOW);
- }
- if (sensorValue>700){
- digitalWrite (ledR,HIGH);
- }
- else{
- digitalWrite (ledR,LOW);
- }
- Serial.print("sensor = " );
- Serial.println(sensorValue);
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement