Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <Servo.h>
Servo myservo;
int yellow = 7;
int red = 6;
int speakerPin = 8;
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// the setup function runs once when you press reset or power the board
void setup() {
myservo.attach(9);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("LCD booting up");
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(yellow, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(yellow, LOW); // turn the LED off by making the voltage LOW
digitalWrite(red, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(red, LOW); // turn the LED off by making the voltage LOW
tone(speakerPin, 440, 200); //play tone on pin 8 of 440 Hz for 200 ms
delay(200);
tone(speakerPin, 240, 200); //play tone on pin 8 of 240 Hz for 200 ms
delay(200);
tone(speakerPin, 120, 200);
delay(200);
tone(speakerPin, 880, 200);
delay(200);
noTone(speakerPin);
lcd.setCursor(0, 1);
lcd.print("yay");
delay(500);
lcd.setCursor(0, 1);
lcd.print("Arduino");
delay(500);
lcd.setCursor(0, 1);
lcd.print(" ");
delay(500);
lcd.setCursor(0, 0);
lcd.print("daftbot rocks");
delay(1000);
lcd.setCursor(0, 0);
lcd.print(" ");
delay(1000);
// lcd.begin(16, 2);
// Print a message to the LCD.
//lcd.print("rocks");
//
delay(1000);
myservo.write(100); // tell servo to go to position in variable 'pos'
delay(1000); // waits 15ms for the servo to reach the position
myservo.write(20); // tell servo to go to position in variable 'pos'
delay(300);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.