// #include<Servo.h>
// Servo servo;
// const int pot = A0;
// const int servoPin = 11;
// void setup() {
// servo.attach(servoPin);
// pinMode (pot, INPUT);
// pinMode(servoPin,OUTPUT);
// Serial.begin(9600);
// }
// void loop() {
// // Serial.println(analogRead(pot));
// int potValue = analogRead(pot);
// int potMappedValue = map(potValue, 0, 1023, 0, 180);
// Serial.println(potMappedValue);
// servo.write(potMappedValue);
// delay(50);
// }
unsigned long startMillis; //some global variables available anywhere in the program
unsigned long currentMillis;
const unsigned long period = 1000; //the value is a number of milliseconds
const byte ledPin = 13; //using the built in LED
void setup()
{
Serial.begin(115200); //start Serial in case we need to print debugging info
pinMode(ledPin, OUTPUT);
startMillis = millis(); //initial start time
}
void loop()
{
currentMillis = millis(); //get the current "time" (actually the number of milliseconds since the program started)
if (currentMillis - startMillis >= period) //test whether the period has elapsed
{
digitalWrite(ledPin, !digitalRead(ledPin)); //if so, change the state of the LED. Uses a neat trick to change the state
startMillis = currentMillis; //IMPORTANT to save the start time of the current LED state.
}
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
pot1:VCC
pot1:SIG
pot1:GND
servo1:GND
servo1:V+
servo1:PWM