How/Where do I read the serial.println?

I’ve uploaded some code to my spark which is working fine. However I want to be able to read the analog values I’m getting of my FSR . I’ve downloaded Putty, and it only seems to detect my spark core when it’s in listening mode, and when that’s the case the code isn’t running so I don’t get any values.

That is an often asked question on this forum and it is always answered the same:

You have to use Serial.begin(115200); (or any other baud rate) in your setup().

Please use the search function - it does work :wink:
e.g.

4 Likes

Hi @Kevinruder

One of the weird things about USB devices is that being connected and drawing power from USB does not trigger a software driver to be loaded for a device on a PC etc. This device has to be enumerated in USB-speak before the driver is loaded and the device becomes available.

On Spark that means that until you execute the line Serial.begin(9600); your Spark core does not look like a USB device to the PC. After that line it is enumerated and becomes available. A good strategy on PCs is to wait for a keypress over the serial port before proceeding with the debugging, but you should remember you core will look “hung” until you press a key:

void setup()
{
  Serial.begin(9600);
  while(!Serial.available()) { 
    SPARK_WLAN_Loop(); 
  }

  Serial.println("connecting...");
...

On Macs and Linux you don’t have to wait–you can just connect after the core boots up.

3 Likes

Oh its working now :slight_smile: thank for the help !

1 Like