Computer For ABE
Computer For ABE
14;
String msg2="Volume=";
String msg3="Diameter=";
float Diameter;
float Volume;
void setup() {
Serial.begin(9600);
void loop() {
Serial.println (msg1);
while (Serial.available()==0){;
Diameter=Serial.parseFloat();
Volume=(4.0/3.0)*3.14*((Diameter/2)*(Diameter/2)*(Diameter/2));
Serial.print (msg3);
Serial.println (Diameter);
Serial.println (msg2);
Serial.println (Volume);
Serial.println ();
}
CODE 2
int L;
int redBlink=5;
int yellowBlink=10;
int greenBlink=15;
int dt = 400;
int redLED=9;
int yellowLED=18;
int greenLED=27;
void setup() {
pinMode(redLED,OUTPUT);
pinMode(yellowLED, OUTPUT);
pinMode(greenLED, OUTPUT);
void loop() {
digitalWrite (redLED,HIGH);
delay (dt);
digitalWrite (yellowLED,HIGH);
delay (dt);
delay (dt);
while Serial.available ();
PUSH BUTTON
int redLED = 7;
int buttonPin = 8;
int buttonRead;
int dt = 250;
void setup() {
Serial.begin (9600);
void loop() {
buttonRead = digitalRead(buttonPin);
Serial.println (buttonRead);
delay(dt);
if (buttonRead == 0){
if (buttonRead ==1){
int redLED = 7;
int buttonPin = 8;
int LEDstate = 0;
int buttonNew;
int buttonOld = 1;
int dt = 250;
void setup() {
Serial.begin (9600);
void loop() {
Serial.println (buttonNew);
if (LEDstate == 0){
LEDstate = 1;
else{
LEDstate = 0;
buttonOld = buttonNew;
delay (dt);
}
POTENTIOMETER AND LCD
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
int potVal;
float Volt;
int dt = 100;
void setup() {
pinMode (pot,INPUT);
Serial.begin(9600);
lcd.begin (16,2);
void loop() {
potVal = analogRead(pot);
Volt = (5./1023.)*potVal;
Serial.println (Volt);
delay (dt);
lcd.init ();
lcd.backlight ();
if (Volt >4.0){
lcd.setCursor (4,0);
lcd.print ("Danger!!!");
lcd.setCursor (2,1);
lcd.print("High Voltage!");
}
else if (Volt < 2.5){
lcd.setCursor (6,0);
lcd.print ("Safe!");
lcd.setCursor (2,1);
lcd.print("Continue Ops");
else {
lcd.setCursor (2,0);
lcd.print ("Warning!");
lcd.setCursor (2,1);
lcd.print("Attention!!!");
SOUND SENSOR
int sound;
int dt = 100;
int redLED = 7;
void setup() {
Serial.begin (9600);
void loop() {
Serial.println(sound);
else {
WATER SENSOR
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
int waterVal;
int dt = 100;
void setup() {
Serial.begin (9600);
lcd.begin (16,2);
void loop() {
Serial.println (waterVal);
delay (dt);
lcd.init ();
lcd.backlight ();
lcd.setCursor (0.1);
lcd.print ("Empty");
lcd.setCursor (0.1);
lcd.print ("LOW");
lcd.setCursor (0.1);
lcd.print ("MEDIUM");
lcd.setCursor (0.1);
lcd.print ("HIGH");
else {
lcd.setCursor (0.1);
lcd.print ("FULL");