- Install PlatformIO or equivalent
- Follow the scematic/reference breadboard
- I'm thinking one D1-mini per goal for now..
#include <Arduino.h> | |
#define PIN_DETECT1 D4 // Infrared receiver ( IR photo module TSOP1738, TSOP34838) | |
#define PIN_STATUS D2 // IR led | |
#define IR_LED D3 // IR led | |
#define FREQ 38000 | |
int score = 0; | |
void notifyGoal() { | |
// Implement the post/put network call here | |
} | |
void setup() { | |
Serial.begin(115200); | |
delay(2000); | |
//pinMode(IR_LED, OUTPUT); | |
pinMode(PIN_STATUS, OUTPUT); | |
pinMode(PIN_DETECT1, INPUT); | |
tone(IR_LED, 38000U); | |
Serial.print("Setup done"); | |
} | |
void loop() { | |
if (digitalRead(PIN_DETECT1) == HIGH) { | |
digitalWrite(PIN_STATUS, LOW); | |
}else { | |
digitalWrite(PIN_STATUS, HIGH); | |
} | |
} |
#include <Arduino.h> | |
#include <ESP8266WiFi.h> // Include the Wi-Fi library | |
const char* ssid = "JaywayGuest"; // The SSID (name) of the Wi-Fi network you want to connect to | |
const char* password = "jaywayguest"; // The password of the Wi-Fi network | |
#define PIN_DETECT1 D4 // Infrared receiver ( IR photo module TSOP1738, TSOP34838) | |
#define PIN_STATUS D2 // IR led | |
#define IR_LED D3 // IR led | |
int score = 0; | |
void notifyGoal() { | |
// Implement the post/put network call here | |
} | |
void setup() { | |
Serial.begin(115200); | |
delay(1000); | |
Serial.println('\n'); | |
WiFi.begin(ssid, password); // Connect to the network | |
Serial.print("Connecting to "); | |
Serial.print(ssid); Serial.println(" ..."); | |
int i = 0; | |
while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect | |
delay(1000); | |
Serial.print(++i); Serial.print(' '); | |
} | |
Serial.println('\n'); | |
Serial.println("Connection established!"); | |
Serial.print("IP address:\t"); | |
Serial.println(WiFi.localIP()); // Send the IP address of the ESP8266 to the computer | |
//pinMode(IR_LED, OUTPUT); | |
pinMode(PIN_STATUS, OUTPUT); | |
pinMode(PIN_DETECT1, INPUT); | |
tone(IR_LED, 38000U); | |
Serial.print("Setup done"); | |
} | |
void loop() { | |
if (digitalRead(PIN_DETECT1) == HIGH) { | |
digitalWrite(PIN_STATUS, LOW); | |
}else { | |
digitalWrite(PIN_STATUS, HIGH); | |
} | |
} |
; PlatformIO Project Configuration File | |
; | |
; Build options: build flags, source filter | |
; Upload options: custom upload port, speed and extra flags | |
; Library options: dependencies, extra library storages | |
; Advanced options: extra scripting | |
; | |
; Please visit documentation for the other options and examples | |
; http://docs.platformio.org/page/projectconf.html | |
[env:d1_mini] | |
platform = espressif8266 | |
board = d1_mini | |
framework = arduino | |
lib_deps = | |
ESP8266WiFi |