Today we coded with circuit boards and with servo on Aduino program. We also used LED lights and made them flash and light up in various ways.
Idea: make a device that extends and can grab things.
My Code:
#include <Servo.h>
Servo Libby;
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
//where the servo power comes from
Libby.attach (6);
LED power comes from digital 13
}
//the loop routine runs over and over again forever
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
int s = map(sensorValue,0,1023,0,180); // made value of sevo change from 0-1023 to 0-180
Serial.println(s); //
delay(1); // delay in between reads for stability
Libby.write(s); // delay by s amount of seconds
}