[SOLVED] Email and Twitter with USB

Is the Twitter and the Email widget possible for Blynk connected over a USB? (I am not using a shield!) I modified the Email and Twitter sketch to fit for a USB connection, see #included section and cannot get the email to work. Is this an issue with my server? My connection? Is it possible with a USB at all?

Thank you.

#include <SoftwareSerial.h>
SoftwareSerial SwSerial(2, 3); // RX, TX
#define BLYNK_PRINT SwSerial
#include <BlynkSimpleSerial.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "------------------------------------";


void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth);

  while (Blynk.connect() == false) {
    // Wait until connected
  }

  // Send e-mail when your hardware gets connected to Blynk Server
  // Just put the recepient's "e-mail address", "Subject" and the "message body"
  Blynk.email("retesian@gmail.com", "hello", "My Blynk project is online.");

  // Setting the button
  pinMode(2, INPUT_PULLUP);
  // Attach pin 2 interrupt to our handler
  attachInterrupt(digitalPinToInterrupt(2), emailOnButtonPress, CHANGE);
}

void emailOnButtonPress()
{
  // *** WARNING: You are limited to send ONLY ONE E-MAIL PER MINUTE! ***

  // Let's send an e-mail when you press the button
  // connected to digital pin 2 on your Arduino

  int isButtonPressed = !digitalRead(2); // Invert state, since button is "Active LOW"

  if (isButtonPressed) // You can write any condition to trigger e-mail sending
  {
    BLYNK_LOG("Button is pressed."); // This can be seen in the Serial Monitor
    Blynk.email("retesian@gmail.com", "Subject: Button Logger", "You just pushed the button...");

  }
}

void loop()
{
  Blynk.run();
}

Here’s an image of my server bat being run so I can connect my Arduino Uno.

Should work. Are you able to trigger led 13?

Hello. Yeap, should work. Don’t you get any email? Is that valid email?

Thanks for the quick responses. I have no LED under 13.

Yes, the email is valid. Unfortunately no email. I’ve been having the issue for a few days, trying to figure it out.

Does push notifications work for you?

You should have led on pin 13. it’s UNO onboard :wink:

Oh, forgive me I misunderstood. It’s on, but orange colored. I can control my LED’s color, but again the twitter/email does not work.

Push notifications don’t work either.

Should I try to host the blynk server locally instead of using the blynk cloud? Could this be the issue? It seems to be an issue with the blynk device being detected as running, as it should tweet as soon as connected if I’m not mistaken.

@retesian are you from China? It could an explanation.

No, I am not. The sketch worked today actually, it tweeted once. Now I’m trying to get it to happen again.

I figured out the issue. It was so simple it hurts.

You have to press the play button on the Blynk app BEFORE you upload the sketch apparently. Everything works great, thank you.

That is not normally the case but the app MUST be in play mode for it to work. You can stop and start the app, upload a sketch, wait 10 hours and then press play and it should be fine.

This order of actions is not necessary, but to use twitter, emails and notifications your app should be in PLAY mode.

Hah. Lol…