-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.ino
More file actions
55 lines (47 loc) · 1.08 KB
/
Copy pathmain.ino
File metadata and controls
55 lines (47 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Include the Libraries
#include <WiFi.h>
#include <HTTPClient.h>
#include <ArduinoJson.h>
// Wifi Credentials
const char* ssid = "Your Wifi SSID";
const char* password = "Your Wifi Password";
// Teleclaw Login
const char* apiUsername = "Please Contact Teleclaw";
const char* apiPassword = "Please Contact Teleclaw";
// Variables and Tokens
String userToken;
String userId;
String appId;
String did;
String token;
// Define Pin
const int blinkPin = 16;
const int switchPin = 32;
const int button1Pin = 25;
const int xPin = 33;
const int yPin = 34;
// Define Pin Readings
int buttonState;
int button1State;
int xVal;
int yVal;
void setup() {
pinMode(blinkPin,switchPin,xPin,yPin,button1Pin);
Serial.begin(115200);
wifi();
if(WiFi.status() == WL_CONNECTED){
login();
}
}
void loop() {
// Readings from the Pin
buttonState = digitalRead(switchPin);
button1State = digitalRead(button1Pin);
xVal = analogRead(xPin);
yVal = analogRead(yPin);
if(WiFi.status() == WL_CONNECTED){
switchState(buttonState);
joyStickControl(xVal,yVal);
catchGift(button1State);
}
}