8000 Add files via upload · The-Assembly/Arduino-IOT@97c293f · GitHub
[go: up one dir, main page]

Skip to content

Commit 97c293f

Browse files
authored
Add files via upload
1 parent 5be591d commit 97c293f

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

Final Code/IDE_FINAL_all_/IDE_FINAL_all_.ino

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
#include <Servo.h> //only for Servo
77

88

9-
char SSID[] = " "; // ENTER NETWORK SSID & PASS
10-
char PASS[] = " ";
9+
char SSID[] = ""; // ENTER NETWORK SSID & PASS
10+
char PASS[] = "";
1111

12-
#define BOTtoken " " //YOUR BOT TOKEN
12+
#define BOTtoken "" //YOUR BOT TOKEN
1313
#define LEDPIN 2 //YOUR PIN NUMBER ON BOARD
1414
#define DHTPIN 5
1515
#define LDRPIN A0
@@ -113,6 +113,29 @@ void loop() {
113113
Serial.println(pulse); // will print the value of the pulse in the serial monitor
114114
}
115115

116+
117+
if (bot.messages[i].text == "/FADE")
118+
{
119+
120+
pulse = 0;
121+
while (pulse < 255)
122+
{
123+
pulse = pulse + 40;
124+
analogWrite(LEDPIN, pulse);
125+
delay(300);
126+
}
127+
while (pulse > 0)
128+
{
129+
pulse = pulse - 40;
130+
analogWrite(LEDPIN, pulse);
131+
delay(300);
132+
}
133+
pulse = 0;
134+
135+
bot.sendMessage(bot.messages[i].chat_id,"LED has faded!", ""); // The bot will notifiy you that it is turned off
136+
137+
138+
}
116139
if (bot.messages[i].text == "/TEMP")
117140
bot.sendMessage(bot.messages[i].chat_id, "Temperature is " + String(myTemperature) + "*C", "");
118141

@@ -141,7 +164,7 @@ void loop() {
141164
}
142165

143166
if (bot.messages[i].text == "/OFFservo") {
144-
myservo.write(0); // sets the servo position
167+
myservo.detach(); // sets the servo position
145168
bot.sendMessage(bot.messages[i].chat_id, "Servo is OFF", "");
146169
}
147170

@@ -160,7 +183,7 @@ void loop() {
160183

161184
if (bot.messages[i].text == "help")
162185
{
163-
bot.sendMessage(bot.messages[i].chat_id, "Hello ASSEMBLY attendee! I am your bot! \n Use following commands: \n /ON - turns on the LED connected \n /OFF - turns off LED connected \n /TEMP - gives temperature \n /HUMID - gives humidity \n /Increase - increases LED brightness \n /Decrease - decreases LED brightness \n /ONservo - pushes servo out \n /OFFservo - pulls servo back \n /TRYservo - test servo", "");
186+
bot.sendMessage(bot.messages[i].chat_id, "Hello ASSEMBLY attendee! I am your bot! \n Use following commands: \n /ON - turns on the LED connected \n /OFF - turns off LED connected \n /TEMP - gives temperature \n /HUMID - gives humidity \n /Increase - increases LED brightness \n /Decrease - decreases LED brightness \n /FADE - shows led fading \n /ONservo - pushes servo out \n /OFFservo - pulls servo back \n /TRYservo - test servo", "");
164187
}
165188

166189

0 commit comments

Comments
 (0)
0