Closed vanbwodonk closed 8 years ago
Hi, i'm looking forwards this library to support Ethernet Shield maybe. Is it possible? I already try with ethernet library but still fail communication with telegram API. This is my code.
`#include
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x12 }; IPAddress ip(192, 168, 5, 198); IPAddress myDns(192, 168, 5, 9); IPAddress gateway(192, 168, 5, 9); IPAddress subnet(255, 255, 255, 0);
// Initialize Telegram BOT const String BotToken = "xxxx"; const String BotName = "yyy"; const String BotUsername = "zzzz"; EthernetClient client; TelegramBot bot (BotToken, BotName, BotUsername, client); const int ledPin = 13; // the number of the LED pin void setup() { Ethernet.begin(mac, ip, myDns, gateway, subnet); Serial.begin(9600); delay(3000); bot.begin(); pinMode(ledPin, OUTPUT); } void loop() { message m = bot.getUpdates(); // Read new messages if ( m.text.equals("On")) { digitalWrite(ledPin, HIGH); bot.sendMessage(m.chat_id, "The Led is now ON"); } else if ( m.text.equals("Off")) { digitalWrite(ledPin, LOW); bot.sendMessage(m.chat_id, "The Led is now OFF"); } }`
@vanbwodonk witch arduino board are you using?
Arduino UNO,
@vanbwodonk unfortunately Arduino ethernet shield doesn't support https. And this makes it impossible to connect to the telegram API.
Hi, i'm looking forwards this library to support Ethernet Shield maybe. Is it possible? I already try with ethernet library but still fail communication with telegram API. This is my code.
`#include
include
include
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x12 }; IPAddress ip(192, 168, 5, 198); IPAddress myDns(192, 168, 5, 9); IPAddress gateway(192, 168, 5, 9); IPAddress subnet(255, 255, 255, 0);
// Initialize Telegram BOT const String BotToken = "xxxx"; const String BotName = "yyy"; const String BotUsername = "zzzz"; EthernetClient client; TelegramBot bot (BotToken, BotName, BotUsername, client); const int ledPin = 13; // the number of the LED pin void setup() { Ethernet.begin(mac, ip, myDns, gateway, subnet); Serial.begin(9600); delay(3000); bot.begin(); pinMode(ledPin, OUTPUT); } void loop() { message m = bot.getUpdates(); // Read new messages if ( m.text.equals("On")) { digitalWrite(ledPin, HIGH); bot.sendMessage(m.chat_id, "The Led is now ON"); } else if ( m.text.equals("Off")) { digitalWrite(ledPin, LOW); bot.sendMessage(m.chat_id, "The Led is now OFF"); } }`