Arduino

Keziah Hoyt

Today we learned how to use arduino. First we used a premade code to make an LED light up and then blink. Then we made a Servo move usinng a code given to us. Then we made a potentiometer work using a different code given to us. Then we were challenged to combine the servo and potentiometer code to make the two connected. Once we did that we were challenged to add an LED to the mix. 

Here is the LED, Servo, and potentiometer combined code:

//data base for this servo
#include <Servo.h>
//servo is named Keziah
Servo Keziah;
//the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  // Servo power comes from digital 6
  Keziah.attach(6);
  // LED power comes from digital 13
  pinMode(13, OUTPUT);
}

// 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);
  // printing value of s(0-180)
  Serial.println(s);
  // move the servo to angle s
  Keziah.write(s);
  // turn the LED on (HIGH is the voltage level)  
digitalWrite(13, HIGH); 
  // wait for s amount of seconds
  delay(s);
  // turn the LED off by making the voltage LOW             
  digitalWrite(13, LOW); 
  // delayed by s amount of seconds
  delay(s);
  }

An Idea for the studio could be a prosthetic that helps with simple daily tasks

Servo and LED with Aduino

Libby Pohl

 

 

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 

}