sci-oly-detector-building

[RADIOACTIVE] arduino thermometer for science olympiad
git clone git://git.figbert.com/sci-oly-detector-building.git
Log | Files | Refs | LICENSE

commit 33a30746cfe21bcdea13640500f60c28a3e7d960
Author: therealFIGBERT <figbertwelner@gmail.com>
Date:   Fri, 14 Feb 2020 18:58:59 -0800

:tada: Initial commit

Diffstat:
A.gitignore | 6++++++
AScreenDisplayTemperatureTest/ScreenDisplayTemperatureTest.ino | 21+++++++++++++++++++++
ASunFounderLCDTest/SunFounderLCDTest.ino | 29+++++++++++++++++++++++++++++
AVoltageTest/VoltageTest.ino | 27+++++++++++++++++++++++++++
4 files changed, 83 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,6 @@ +.DS_Store +.idea +.env.local +.env.development.local +.env.test.local +.env.production.local diff --git a/ScreenDisplayTemperatureTest/ScreenDisplayTemperatureTest.ino b/ScreenDisplayTemperatureTest/ScreenDisplayTemperatureTest.ino @@ -0,0 +1,21 @@ +#include <Wire.h> +#include <LiquidCrystal_I2C.h> +LiquidCrystal_I2C lcd(0x27, 16, 2); + +void setup() { + lcd.init(); + lcd.backlight(); + Serial.begin(9600); +} + +void loop() { + int sensorValue = analogRead(A0); + float voltage = sensorValue * (5.0 / 1023.0); + int leftSideOfRatio = 5 / voltage; + String HalfwayThroughCircutVolts = String(voltage) + " V"; + String RatioBetweenCenterAndStartVolts = String(leftSideOfRatio) + ":1"; + lcd.setCursor(5, 0); + lcd.print(HalfwayThroughCircutVolts); + lcd.setCursor(6, 1); + lcd.print(RatioBetweenCenterAndStartVolts); +} diff --git a/SunFounderLCDTest/SunFounderLCDTest.ino b/SunFounderLCDTest/SunFounderLCDTest.ino @@ -0,0 +1,29 @@ +/******************************** + name:I2C LCD1602 + function:You should now see your I2C LCD1602 display the flowing characters: "SunFounder" and "hello, world". + ********************************/ +//Email:support@sunfounder.com +//Website:www.sunfounder.com + +/********************************/ +// include the library code +#include <Wire.h> +#include <LiquidCrystal_I2C.h> +/**********************************************************/ +LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display +/*********************************************************/ +void setup() +{ + lcd.init(); //initialize the lcd + lcd.backlight(); //open the backlight +} +/*********************************************************/ +void loop() +{ + lcd.setCursor(3, 0); // set the cursor to column 3, line 0 + lcd.print("SunFounder"); // Print a message to the LCD + + lcd.setCursor(2, 1); // set the cursor to column 2, line 1 + lcd.print("Hello, World!"); // Print a message to the LCD. +} +/************************************************************/ diff --git a/VoltageTest/VoltageTest.ino b/VoltageTest/VoltageTest.ino @@ -0,0 +1,27 @@ +/* + ReadAnalogVoltage + + Reads an analog input on pin 0, converts it to voltage, and prints the result to the Serial Monitor. + Graphical representation is available using Serial Plotter (Tools > Serial Plotter menu). + Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground. + + This example code is in the public domain. + + http://www.arduino.cc/en/Tutorial/ReadAnalogVoltage +*/ + +// the setup routine runs once when you press reset: +void setup() { + // initialize serial communication at 9600 bits per second: + Serial.begin(9600); +} + +// the loop routine runs over and over again forever: +void loop() { + // read the input on analog pin 0: + int sensorValue = analogRead(A0); + // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V): + float voltage = sensorValue * (5.0 / 1023.0); + // print out the value you read: + Serial.println(voltage); +}