Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
Internet of Things source code
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
harry.sawdon
Internet of Things source code
Commits
d3862d20
Commit
d3862d20
authored
Jan 16, 2023
by
harry.sawdon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Source code final
parents
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
0 deletions
+76
-0
Arduino Source Code
Arduino Source Code
+76
-0
No files found.
Arduino Source Code
0 → 100644
View file @
d3862d20
#include <Wire.h>
#include "rgb_lcd.h"
#include <WiFiNINA.h>
#include "ThingSpeak.h"
rgb_lcd lcd;
const int pinLight = A0;
bool brightness()
{
return (analogRead(pinLight)<80);
}
void setup()
{
lcd.begin(16, 2);
lcd.setCursor(0, 0);
char ssid[] = "AndroidAP";
char password[] = "crer0439";
int status = WL_IDLE_STATUS;
Serial.begin(9600);
status = WiFi.begin(ssid, password);
if(status != WL_CONNECTED){
lcd.println("Failed");
while (true);
}
else{
lcd.println(WiFi.localIP());
}
pinMode(3, OUTPUT);
}
void loop(){
const unsigned long channel_id = 1996098;
const char write_api_key[] = "U5ME119V07YLVSTG";
WiFiClient client;
ThingSpeak.begin(client);
while(true){
int value = analogRead(A0);
lcd.setCursor(9, 1);
lcd.print(value);
; ThingSpeak.setField(1, int(value));
ThingSpeak.writeFields(channel_id, write_api_key);
if(!brightness())
{
digitalWrite(3, HIGH);
delay(1000);
digitalWrite(3, LOW);
delay(1000);
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment