1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
// include the library code:
#include <LiquidCrystal.h>
//FROM CRYSALL BALL
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// set up a constant for the tilt switchPin
const int switchPin = 6;
// variable to hold the value of the switchPin
int switchState = 0;
// variable to hold previous value of the switchpin
int prevSwitchState = 0;
// a variable to choose which reply from the crystal ball
int reply;
//FROM BLINK
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
int menubutton = 7;
//FROM LOVE METER
// named constant for the pin the sensor is connected to
const int sensorPin = A0;
void setup() {
// open a serial connection to display values
Serial.begin(9600); //LOVE
// initialize the digital pin as an output.
pinMode(led, OUTPUT); //BLINK
pinMode(menubutton, INPUT);
// set up the number of columns and rows on the LCD
lcd.begin(16, 2);
// set up the switch pin as an input
pinMode(switchPin,INPUT);
// Print a message to the LCD.
lcd.print("Boot");
// set the cursor to column 0, line 1
// line 1 is the second row, since counting begins with 0
lcd.setCursor(0, 1);
// print to the second line
lcd.print("BOOT!!");
delay(2500);
// int a = 0;
}
void loop() {
// read the value on AnalogIn pin 0
// and store it in a variable
int sensorVal = analogRead(sensorPin);
Serial.print("sensor Value: ");
Serial.print(sensorVal);
float voltage = (sensorVal/1024.0) * 5.0;
Serial.print(", Volts: ");
Serial.print(voltage);
// ((volatge - 500mV) times 100)
Serial.print(", degrees C: ");
float temperature = (voltage - .5) * 100;
Serial.println(temperature);
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("Yes");
lcd.setCursor(0, 0);
lcd.print(temperature);
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("No");
lcd.setCursor(0, 0);
lcd.print(temperature);
for (int a=0; a < 20; a = a +1)//; (menubutton) == LOW)
{
lcd.setCursor(0, 0);
lcd.print(temperature);
lcd.setCursor(0, 1);
lcd.print(a);
delay(50);
}
/*
*/
}
|