Skip to content

Commit d544473

Browse files
committed
New Examples
- Relay (ToDo: drawing) - RGB LED Stripe (5050)
1 parent d022672 commit d544473

File tree

6 files changed

+14
-135
lines changed

6 files changed

+14
-135
lines changed

examples/Light/5050_Light/5050_Light.ino renamed to examples/Light/RGB_LED_Stripe_5050/RGB_LED_Stripe_5050.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
#define LIGHT_ID "YOUR-DEVICEID" // Should look like "5dc1564130xxxxxxxxxxxxxx"
3737
#define BAUD_RATE 9600 // Change baudrate to your need for serial log
3838

39-
#define RED_PIN D6 // PIN for RED Mosfet - change this to your need
40-
#define GREEN_PIN D7 // PIN for GREEN Mosfet - change this to your need
41-
#define BLUE_PIN D8 // PIN for BLUE Mosfet - change this to your need
39+
#define BLUE_PIN D5 // PIN for BLUE Mosfet - change this to your need (D5 = GPIO14 on ESP8266)
40+
#define RED_PIN D6 // PIN for RED Mosfet - change this to your need (D6 = GPIO12 on ESP8266)
41+
#define GREEN_PIN D7 // PIN for GREEN Mosfet - change this to your need (D7 = GPIO13 on ESP8266)
4242

4343
struct { // Stores current device state with following initial values:
4444
bool powerState = false; // initial state is off
223 KB
Loading

examples/Switch/Switch_beginner/Switch_beginner.ino renamed to examples/Switch/Relay/Relay.ino

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -36,40 +36,22 @@
3636
#define SWITCH_ID "YOUR-DEVICE-ID" // Should look like "5dc1564130xxxxxxxxxxxxxx"
3737
#define BAUD_RATE 9600 // Change baudrate to your need
3838

39-
#define RELAY_PIN D5 // pin where Relay is connected. Change the pin if required. D5 mapping is from https://github.com/esp8266/Arduino/blob/master/variants/d1_mini/pins_arduino.h#L49-L61
40-
39+
#define RELAY_PIN D5 // Pin where the relay is connected (D5 = GPIO 14 on ESP8266)
4140

4241
bool onPowerState(const String &deviceId, bool &state) {
43-
Serial.printf("Device %s turned %s (via SinricPro) \r\n", deviceId.c_str(), state?"on":"off");
44-
digitalWrite(RELAY_PIN, state);
45-
return true; // request handled properly
46-
}
47-
48-
void setupWiFi() {
49-
Serial.printf("\r\n[Wifi]: Connecting");
50-
WiFi.begin(WIFI_SSID, WIFI_PASS);
51-
52-
while (WiFi.status() != WL_CONNECTED) {
53-
Serial.printf(".");
54-
delay(250);
55-
}
56-
Serial.printf("connected!\r\n[WiFi]: IP-Address is %s\r\n", WiFi.localIP().toString().c_str());
57-
}
58-
59-
void setupSinricPro() {
60-
SinricProSwitch& mySwitch = SinricPro[SWITCH_ID];
61-
mySwitch.onPowerState(onPowerState);
62-
SinricPro.begin(APP_KEY, APP_SECRET);
42+
digitalWrite(RELAY_PIN, state); // set pin state
43+
return true; // request handled properly
6344
}
6445

6546
void setup() {
66-
pinMode(RELAY_PIN, OUTPUT); // define LED GPIO as output
47+
pinMode(RELAY_PIN, OUTPUT); // set relay-pin to output mode
48+
WiFi.begin(WIFI_SSID, WIFI_PASS); // start wifi
6749

68-
Serial.begin(BAUD_RATE); Serial.printf("\r\n\r\n");
69-
setupWiFi();
70-
setupSinricPro();
50+
SinricProSwitch& mySwitch = SinricPro[SWITCH_ID]; // create new switch device
51+
mySwitch.onPowerState(onPowerState); // apply onPowerState callback
52+
SinricPro.begin(APP_KEY, APP_SECRET); // start SinricPro
7153
}
7254

7355
void loop() {
74-
SinricPro.handle();
56+
SinricPro.handle(); // handle SinricPro commands
7557
}

examples/Switch/WeMosD1_mini_relay_shield/WeMosD1_mini_relay_shield.ino

Lines changed: 0 additions & 103 deletions
This file was deleted.

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SinricPro
2-
version=2.7.4
2+
version=2.7.5
33
author=Boris Jaeger <[email protected]>
44
maintainer=Boris Jaeger <[email protected]>
55
sentence=Library for https://sinric.pro - simple way to connect your device to alexa

src/SinricProConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// Version Configuration
2626
#define SINRICPRO_VERSION_MAJOR 2
2727
#define SINRICPRO_VERSION_MINOR 7
28-
#define SINRICPRO_VERSION_REVISION 4
28+
#define SINRICPRO_VERSION_REVISION 5
2929
#define SINRICPRO_VERSION STR(SINRICPRO_VERSION_MAJOR) "." STR(SINRICPRO_VERSION_MINOR) "." STR(SINRICPRO_VERSION_REVISION)
3030
#define SINRICPRO_VERSION_STR "SinricPro (v" SINRICPRO_VERSION ")"
3131

0 commit comments

Comments
 (0)