top of page

First Demo of CODES!!!



For a higher speed work on our project, we choose a visual coding tool, Mind+, to support our work. Though all codes are typed by myself, mind+ gives us extremely good support on various libraries of different modules, which saved our time on searching the correct codes of modules in a mess.

Moreover, mind+ also helps me on learning the different code via a visual language instead of an abstract word description.

And I need to thanks all developers around the world. They give me a lot of support on coding on the project.

The full codes are presented below. And I add as more as possible marks on codes for support more people using it for their projects.


/*! * MindPlus * nano * */ #include <DFRobot_PlayerMini.h> #include <DFRobot_LedControl.h> #include <SoftwareSerial.h> #include <DFRobot_DS18B20.h> // Define LedPins #define greenLED 6 #define yellowLED 7 #define redLED 8 // Common Data const uint8_t maxBitmap[][8] = { {B01111111,B01111111,B01100011,B01111111,B01111111,B01100000,B01100000,B01100000}, {B01100000,B01100000,B01100000,B01100000,B01100000,B01100000,B01111110,B01111110}, {B01111110,B01111110,B00001100,B00001000,B00011000,B00110000,B01111110,B01111110}, {B00011100,B00011100,B00011100,B00001000,B00111011,B00001011,B01111111,B01000001}, {B00000000,B00110000,B01111001,B11111011,B10010011,B11000001,B01100011,B00110110}, {B00100000,B01000000,B10101000,B00010001,B00100110,B00001100,B00001010,B00011001}, {B00000000,B00011000,B01011010,B01011010,B01011010,B00111100,B01100110,B11000011}, {B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000} }; // Create Objects DFRobot_LedControl max7219; SoftwareSerial softSerialmp3(10, 11); DFRobot_PlayerMini mp3; DFRobot_DS18B20 ds18b20; int Button = 2; // Main Program void setup() { Serial.begin(9600); mp3.begin(&softSerialmp3); max7219.begin(3, 5, 4); max7219.show(maxBitmap[0]); pinMode(Button, INPUT); ds18b20.begin(12); pinMode(greenLED, OUTPUT); pinMode(yellowLED, OUTPUT); pinMode(redLED, OUTPUT); } void loop() { Serial.print(" degrees C - "); Serial.println(ds18b20.getTempC()); Serial.print(" ButtonStatue - "); Serial.println(digitalRead(Button)); if (digitalRead(Button)==LOW) { delay(10); max7219.show(maxBitmap[7]); Serial.print(" Statue - "); Serial.println("ALL OFF"); } else if (digitalRead(Button)==HIGH) { delay(10); if ( ds18b20.getTempC() >= 32 ) { //temperatureDetect-R digitalWrite(greenLED, LOW); digitalWrite(yellowLED, LOW); digitalWrite(redLED, HIGH); Serial.print(" Statue - "); Serial.println("WARM"); Serial.print(" redLED - "); Serial.println("ON"); for (int index = 0; index < 1; index++) { //music play mp3.play(1); } for (int index = 0; index < 3; index++) { //led animation max7219.show(maxBitmap[0]); delay(500); max7219.show(maxBitmap[1]); delay(500); max7219.show(maxBitmap[2]); delay(500); max7219.show(maxBitmap[3]); delay(500); max7219.show(maxBitmap[4]); delay(500); max7219.show(maxBitmap[5]); delay(500); max7219.show(maxBitmap[6]); delay(500); } delay(1000); digitalWrite(greenLED, LOW); digitalWrite(yellowLED, LOW); digitalWrite(redLED, LOW); Serial.print(" redLED - "); Serial.println("OFF"); max7219.show(maxBitmap[7]); mp3.pause(); while (!(32>ds18b20.getTempC())) {} }//redLED else if ( 32 > ds18b20.getTempC() && ds18b20.getTempC()>=30) { //temperatureDetect-Y digitalWrite(greenLED, LOW); digitalWrite(yellowLED, HIGH); digitalWrite(redLED, LOW); Serial.print(" Statue - "); Serial.println("Confort"); Serial.print(" yellowLED - "); Serial.println("ON"); for (int index = 0; index < 1; index++) { //music play mp3.play(2); } for (int index = 0; index < 3; index++) { //led animation max7219.show(maxBitmap[0]); delay(500); max7219.show(maxBitmap[1]); delay(500); max7219.show(maxBitmap[2]); delay(500); max7219.show(maxBitmap[3]); delay(500); max7219.show(maxBitmap[4]); delay(500); max7219.show(maxBitmap[5]); delay(500); max7219.show(maxBitmap[6]); delay(500); } delay(1000); digitalWrite(greenLED, LOW); digitalWrite(yellowLED, LOW); digitalWrite(redLED, LOW); Serial.print(" yellowLED - "); Serial.println("OFF"); max7219.show(maxBitmap[7]); mp3.pause(); while (!((ds18b20.getTempC()>=32) || (30>ds18b20.getTempC()))) {} }//yellowLED else { //temperatureDetect-G digitalWrite(greenLED, HIGH); digitalWrite(yellowLED, LOW); digitalWrite(redLED, LOW); Serial.print(" Statue - "); Serial.println("Cold"); Serial.print(" redLED - "); Serial.println("ON"); for (int index = 0; index < 1; index++) { //music play mp3.play(3); } for (int index = 0; index < 3; index++) { //led animation max7219.show(maxBitmap[0]); delay(500); max7219.show(maxBitmap[1]); delay(500); max7219.show(maxBitmap[2]); delay(500); max7219.show(maxBitmap[3]); delay(500); max7219.show(maxBitmap[4]); delay(500); max7219.show(maxBitmap[5]); delay(500); max7219.show(maxBitmap[6]); delay(500); } delay(1000); digitalWrite(greenLED, LOW); digitalWrite(yellowLED, LOW); digitalWrite(redLED, LOW); Serial.print(" greenLED - "); Serial.println("OFF"); max7219.show(maxBitmap[7]); mp3.pause(); while (!(ds18b20.getTempC()>=30)) {} }//greenLED }//PressDown delay(500); }//WholeLoop


Comments


bottom of page