Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Connected to Adafruit IO, but nothing else
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

Re: Connected to Adafruit IO, but nothing else

by brubell on Thu Aug 08, 2019 9:49 am

Lbkulinski wrote:Thank you for the info! I haven't had much time to look into it.

When I have the serial monitor already open, should I have to reset after I upload? That's the issue I am having at the moment. There are also question marks being printed when I open it. I can attached a screenshot if you need.


The question marks are caused by a mismatched baud rate. Could you paste your code below and attach a screenshot of the serial monitor too?

brubell
 
Posts: 946
Joined: Fri Jul 17, 2015 10:33 pm

Re: Connected to Adafruit IO, but nothing else

by Lbkulinski on Mon Aug 12, 2019 1:41 pm

Sorry for the late reply. I have been trying to resolve an issue with my Metro AirLift board.

I seems that I only get the question marks when I use my MacBook. I am currently using my Windows Desktop and am not having the same behavior. It isn't an issue, I was just curious. Here is my code:

Code: Select all | TOGGLE FULL SIZE
#include "AdafruitIO_WiFi.h"
#include "AdafruitIO_Feed.h"
#include "AdafruitIO_Data.h"

#define USERNAME "Lbkulinski"
#define KEY "my-key"
#define SSID "my-ssid"
#define PASSWORD "my-password"

#define FEED_KEY "toggle"

#define CONNECTED_LED_PIN 13

#define LED_PIN 5

#define BAUD_RATE 9600

AdafruitIO_WiFi io(USERNAME, KEY, SSID, PASSWORD);
AdafruitIO_Feed* feed = io.feed(FEED_KEY);

void setup() {
  pinMode(CONNECTED_LED_PIN, OUTPUT);

  pinMode(LED_PIN, OUTPUT);

  Serial.begin(BAUD_RATE);

  while (!Serial);

  io.connect();

  while (io.status() != AIO_CONNECTED);

  digitalWrite(CONNECTED_LED_PIN, HIGH);

  Serial.println("Connected to Adafruit IO...");

  feed->onMessage(handleMessage);

  feed->get();
} //setup

void loop() {
  io.run();
} //loop

void handleMessage(AdafruitIO_Data* data) {
  int value = data->toPinLevel();

  digitalWrite(LED_PIN, value);

  if (value == HIGH) {
    Serial.println("HIGH");
  } else {
    Serial.println("LOW");
  } //end if
} //handleMessage

Lbkulinski
 
Posts: 116
Joined: Wed May 07, 2014 4:41 pm

Re: Connected to Adafruit IO, but nothing else

by brubell on Mon Aug 12, 2019 5:34 pm

Ok, make sure your serial monitor on your Mac's Arduino IDE is set to 9600 baud

brubell
 
Posts: 946
Joined: Fri Jul 17, 2015 10:33 pm

Re: Connected to Adafruit IO, but nothing else

by Lbkulinski on Mon Aug 12, 2019 9:07 pm

Here are two screenshots using 9600 baud. I believe I was using 115200 at one point and had the same issue. Is there a specific baud rate I should be using?
Attachments
Screen Shot 2019-08-12 at 7.41.55 PM.png
Screen Shot 2019-08-12 at 7.41.55 PM.png (267.54 KiB) Viewed 89 times
Screen Shot 2019-08-12 at 7.41.59 PM.png
Screen Shot 2019-08-12 at 7.41.59 PM.png (264.67 KiB) Viewed 89 times

Lbkulinski
 
Posts: 116
Joined: Wed May 07, 2014 4:41 pm

Re: Connected to Adafruit IO, but nothing else

by brubell on Tue Aug 13, 2019 10:26 am

Try increasing the baud rate in your code, and on your monitor, to 115200 baud.

brubell
 
Posts: 946
Joined: Fri Jul 17, 2015 10:33 pm

Re: Connected to Adafruit IO, but nothing else

by Lbkulinski on Tue Aug 13, 2019 3:03 pm

It displays the same output. It’s odd that it only occurs on my Mac.

Lbkulinski
 
Posts: 116
Joined: Wed May 07, 2014 4:41 pm

Please be positive and constructive with your questions and comments.