Thursday, November 14, 2013

November 14th, Working in Lab

Fans:

Today was the first day during lab that we got to work with the fans that we purchased. We were able to power the fan with a 12 volt battery pack using the code below.



int motor =9;
void setup(){
pinMode (9, OUTPUT);
}
void loop(){
int speed;
speed = 255;
analogWrite(motor,speed);
}
view raw gistfile1.txt hosted with ❤ by GitHub
LCD IR Remote:

We also worked on using an IR remote to control the message that appears on the LCD. A video is shown below of the remote changing the message. The code used is also posted below.

#include <LiquidCrystal.h>
#include <IRremote.h>
LiquidCrystal lcd(12,11,5,4,3,2);
int RECV_PIN = 10;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
lcd.begin(16, 2);
lcd.clear();
lcd.print("System Charging");
delay(3000);
}
void loop ()
{
if (irrecv.decode(&results)) {
Serial.println(results.value);
irrecv.resume();
if(results.value == 3785495787)
{
lcd.setCursor(0,0);
lcd.print("Ramming Speed ");
}
if(results.value == 3785503947)
{
lcd.setCursor(0,0);
lcd.print("Battle Speed ");
}
}
}
view raw gistfile1.txt hosted with ❤ by GitHub

No comments:

Post a Comment