Arduino Projects: Difference between revisions
Content added Content deleted
(→Bluetooth Controlled RGB LED Strip: IR RGB) |
(→Time and Gas Sensor with Display: added sketch) |
||
Line 9: | Line 9: | ||
[[File:Time and Gas Sensor Display.jpg|thumb|right|Time and Gas Sensor Display]] |
[[File:Time and Gas Sensor Display.jpg|thumb|right|Time and Gas Sensor Display]] |
||
<br /> |
|||
<br /> |
|||
<br /> |
|||
<pre style="width: 75%; height: 10pc; overflow-y: scroll;">#include <TM1637.h> |
|||
#include <Wire.h> |
|||
#include <DS3231.h> |
|||
#include <config.h> |
|||
#define CLK 2 //Arduino pins which are connected to Display |
|||
#define DIO 3 |
|||
const byte gas_sensor = 0; |
|||
int gas_level; |
|||
int redLed = 12; |
|||
int buzzer = 10; |
|||
int sensorThres = 400; // Your threshold value |
|||
int i = 0; |
|||
TM1637 display(CLK,DIO); //To work with the chip clock and indicator we use the library |
|||
DS3231 rtc(SDA, SCL); // Init the DS3231 using the hardware interface |
|||
Time t; // Init a Time-data structure |
|||
void beeptone() |
|||
{ |
|||
for(i = 0; i < 255; i = i + 2) |
|||
{ |
|||
analogWrite(buzzer, i); |
|||
delay(10); |
|||
} |
|||
for(i = 255; i > 1; i = i - 2) |
|||
{ |
|||
analogWrite(buzzer, i); |
|||
delay(5); |
|||
} |
|||
for(i = 1; i <= 10; i++) |
|||
{ |
|||
analogWrite(buzzer, 200); |
|||
delay(100); |
|||
analogWrite(buzzer, 25); |
|||
delay(100); |
|||
} |
|||
} |
|||
void setup() |
|||
{ |
|||
// Serial.begin(9600); // Setup Serial connection |
|||
display.set(); //Enable and configure the indicator |
|||
display.init(); |
|||
rtc.begin(); // Initialize the rtc object |
|||
// The following lines can be uncommented to set the date and time |
|||
//rtc.setDOW(WEDNESDAY); // Set Day-of-Week to SUNDAY |
|||
//rtc.setTime(12, 0, 0); // Set the time to 12:00:00 (24hr format) |
|||
//rtc.setDate(1, 1, 2014); // Set the date to January 1st, 2014 |
|||
} |
|||
void loop() |
|||
{ |
|||
int8_t timeDisp[4]; //The values to be displayed on each of 4 bits |
|||
t = rtc.getTime(); //Get data from the DS3231 |
|||
timeDisp[0] = t.hour / 10; //We receive dozens of hours using integer division |
|||
timeDisp[1] = t.hour % 10; //Unit obtain hours using modulo |
|||
timeDisp[2] = t.min / 10; //We do the same with minutes |
|||
timeDisp[3] = t.min % 10; |
|||
display.point(POINT_ON); //colon ON |
|||
display.display(timeDisp); //output it to the screen |
|||
delay (2000); |
|||
gas_level= analogRead(gas_sensor); //Gas Sensor get data |
|||
display.point(POINT_OFF); |
|||
display.DigitDisplayWrite(CLK,DIO,gas_level); |
|||
// Serial.println(gas_level); |
|||
if (gas_level > sensorThres) |
|||
{ |
|||
digitalWrite(redLed, HIGH); |
|||
beeptone(); |
|||
} |
|||
else |
|||
{ |
|||
digitalWrite(redLed, LOW); |
|||
noTone(buzzer); |
|||
} |
|||
delay (2000); |
|||
} |
|||
</pre> |
|||
= Versatile Kitchen Timer = |
= Versatile Kitchen Timer = |
Revision as of 01:16, 27 October 2016
This page is under construction. |
Time and Gas Sensor with Display
#include <TM1637.h> #include <Wire.h> #include <DS3231.h> #include <config.h> #define CLK 2 //Arduino pins which are connected to Display #define DIO 3 const byte gas_sensor = 0; int gas_level; int redLed = 12; int buzzer = 10; int sensorThres = 400; // Your threshold value int i = 0; TM1637 display(CLK,DIO); //To work with the chip clock and indicator we use the library DS3231 rtc(SDA, SCL); // Init the DS3231 using the hardware interface Time t; // Init a Time-data structure void beeptone() { for(i = 0; i < 255; i = i + 2) { analogWrite(buzzer, i); delay(10); } for(i = 255; i > 1; i = i - 2) { analogWrite(buzzer, i); delay(5); } for(i = 1; i <= 10; i++) { analogWrite(buzzer, 200); delay(100); analogWrite(buzzer, 25); delay(100); } } void setup() { // Serial.begin(9600); // Setup Serial connection display.set(); //Enable and configure the indicator display.init(); rtc.begin(); // Initialize the rtc object // The following lines can be uncommented to set the date and time //rtc.setDOW(WEDNESDAY); // Set Day-of-Week to SUNDAY //rtc.setTime(12, 0, 0); // Set the time to 12:00:00 (24hr format) //rtc.setDate(1, 1, 2014); // Set the date to January 1st, 2014 } void loop() { int8_t timeDisp[4]; //The values to be displayed on each of 4 bits t = rtc.getTime(); //Get data from the DS3231 timeDisp[0] = t.hour / 10; //We receive dozens of hours using integer division timeDisp[1] = t.hour % 10; //Unit obtain hours using modulo timeDisp[2] = t.min / 10; //We do the same with minutes timeDisp[3] = t.min % 10; display.point(POINT_ON); //colon ON display.display(timeDisp); //output it to the screen delay (2000); gas_level= analogRead(gas_sensor); //Gas Sensor get data display.point(POINT_OFF); display.DigitDisplayWrite(CLK,DIO,gas_level); // Serial.println(gas_level); if (gas_level > sensorThres) { digitalWrite(redLed, HIGH); beeptone(); } else { digitalWrite(redLed, LOW); noTone(buzzer); } delay (2000); }
Versatile Kitchen Timer
Game of Thrones
http://www.instructables.com/id/Game-Of-Thrones-Theme-on-Arduino/?ALLSTEPS
Led Cube 3x3x3
http://circuitdigest.com/microcontroller-projects/making-3X3X3-led-cube-with-arduino
Bluetooth Controlled RGB LED Strip
https://www.arduino.cc/en/Tutorial/ReadASCIIString https://play.google.com/store/apps/details?id=com.embarcadero.AndroidunoBt&hl=en
IR Controlled RGB LED Strip
http://arduino-cool.blogspot.in/2012/09/arduino-rgb-led-managed-by-remote.html
{{#widget:DISQUS |id=networkm |uniqid=Arduino Projects |url=https://aman.awiki.org/wiki/Arduino_Projects }}