
Blynk_Example
Dependencies: WIZwiki-7500_Blynk WIZnetInterface mbed
Dependents: Blynk_NeoPixelRing_WIZwiki-W7500
main.cpp@1:030843f74e27, 2017-09-05 (annotated)
- Committer:
- jcm931213
- Date:
- Tue Sep 05 23:22:02 2017 +0000
- Revision:
- 1:030843f74e27
- Parent:
- 0:decc160be69d
edit main
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jcm931213 | 0:decc160be69d | 1 | /************************************************************* |
jcm931213 | 0:decc160be69d | 2 | Download latest Blynk library here: |
jcm931213 | 0:decc160be69d | 3 | https://github.com/blynkkk/blynk-library/releases/latest |
jcm931213 | 0:decc160be69d | 4 | Blynk is a platform with iOS and Android apps to control |
jcm931213 | 0:decc160be69d | 5 | Arduino, Raspberry Pi and the likes over the Internet. |
jcm931213 | 0:decc160be69d | 6 | You can easily build graphic interfaces for all your |
jcm931213 | 0:decc160be69d | 7 | projects by simply dragging and dropping widgets. |
jcm931213 | 0:decc160be69d | 8 | Downloads, docs, tutorials: http://www.blynk.cc |
jcm931213 | 0:decc160be69d | 9 | Sketch generator: http://examples.blynk.cc |
jcm931213 | 0:decc160be69d | 10 | Blynk community: http://community.blynk.cc |
jcm931213 | 0:decc160be69d | 11 | Social networks: http://www.fb.com/blynkapp |
jcm931213 | 0:decc160be69d | 12 | http://twitter.com/blynk_app |
jcm931213 | 0:decc160be69d | 13 | Blynk library is licensed under MIT license |
jcm931213 | 0:decc160be69d | 14 | This example code is in public domain. |
jcm931213 | 0:decc160be69d | 15 | ************************************************************* |
jcm931213 | 0:decc160be69d | 16 | This example shows how to use Arduino.org Ethernet Shield 2 (W5500) |
jcm931213 | 0:decc160be69d | 17 | to connect your project to Blynk. |
jcm931213 | 0:decc160be69d | 18 | NOTE: You may have to install Arduino.ORG IDE to get it working: |
jcm931213 | 0:decc160be69d | 19 | http://www.arduino.org/software |
jcm931213 | 0:decc160be69d | 20 | Pins 10, 11, 12 and 13 are reserved for Ethernet module. |
jcm931213 | 0:decc160be69d | 21 | DON'T use them in your sketch directly! |
jcm931213 | 0:decc160be69d | 22 | Feel free to apply it to any other example. It's simple! |
jcm931213 | 0:decc160be69d | 23 | *************************************************************/ |
jcm931213 | 0:decc160be69d | 24 | |
jcm931213 | 0:decc160be69d | 25 | /* Comment this out to disable prints and save space */ |
jcm931213 | 0:decc160be69d | 26 | #define BLYNK_PRINT Serial |
jcm931213 | 0:decc160be69d | 27 | |
jcm931213 | 0:decc160be69d | 28 | #include "mbed.h" |
jcm931213 | 0:decc160be69d | 29 | #include <SPI.h> |
jcm931213 | 0:decc160be69d | 30 | #include "EthernetInterface.h" |
jcm931213 | 0:decc160be69d | 31 | #include <BlynkSimpleEthernet2.h> |
jcm931213 | 0:decc160be69d | 32 | |
jcm931213 | 0:decc160be69d | 33 | |
jcm931213 | 1:030843f74e27 | 34 | EthernetInterface eth0; |
jcm931213 | 0:decc160be69d | 35 | |
jcm931213 | 0:decc160be69d | 36 | // You should get Auth Token in the Blynk App. |
jcm931213 | 0:decc160be69d | 37 | // Go to the Project Settings (nut icon). |
jcm931213 | 0:decc160be69d | 38 | char auth[] = "f6e02fba337e45f19f9c51567323ea8d"; |
jcm931213 | 0:decc160be69d | 39 | |
jcm931213 | 0:decc160be69d | 40 | |
jcm931213 | 0:decc160be69d | 41 | |
jcm931213 | 0:decc160be69d | 42 | |
jcm931213 | 0:decc160be69d | 43 | int main(void) { |
jcm931213 | 0:decc160be69d | 44 | printf("Hello\r\n"); |
jcm931213 | 1:030843f74e27 | 45 | uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0xff, 0xff, 0x25}; |
jcm931213 | 1:030843f74e27 | 46 | eth0.init(mac_addr); |
jcm931213 | 1:030843f74e27 | 47 | eth0.connect(); |
jcm931213 | 1:030843f74e27 | 48 | |
jcm931213 | 1:030843f74e27 | 49 | Blynk.begin(auth); |
jcm931213 | 1:030843f74e27 | 50 | |
jcm931213 | 0:decc160be69d | 51 | printf("Blynk init!\r\n"); |
jcm931213 | 0:decc160be69d | 52 | while(1){ |
jcm931213 | 1:030843f74e27 | 53 | Blynk.run(); |
jcm931213 | 0:decc160be69d | 54 | } |
jcm931213 | 0:decc160be69d | 55 | } |