CasaJasmina / TelegramBot-Library

Host a Telegram Bot on your Arduino, and interact with it from your favourite chat application
GNU Lesser General Public License v2.1
133 stars 52 forks source link

Support for Ethernet Shield #3

Closed vanbwodonk closed 8 years ago

vanbwodonk commented 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

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"); } }`

gibix commented 8 years ago

@vanbwodonk witch arduino board are you using?

vanbwodonk commented 8 years ago

Arduino UNO,

lorenzoromagnoli commented 8 years ago

@vanbwodonk unfortunately Arduino ethernet shield doesn't support https. And this makes it impossible to connect to the telegram API.