Author Topic: Where does Serial.write() go?  (Read 3169 times)

digi_guy

  • Jr. Member
  • **
  • Posts: 87
Where does Serial.write() go?
« on: April 02, 2016, 09:11:35 am »
I had spent a lot of time playing with the Pro+WiFi, and simply assumed the Oak was a better version of that.

After playing around with the Particle.publish() features, I'm left wondering what happened to all the old Serial functions I had used previously. I read somewhere that the Tx/Rx pins are being used by the wifi chip.

So if I use Serial.begin(9600), Serial.write() and Serial.read() where does that go? Can I use it to making the Oak a little server again like I did with the Pro? And does that require #include <ESP8266WiFi.h>

Thanks


driffster

  • Newbie
  • *
  • Posts: 42
Re: Where does Serial.write() go?
« Reply #1 on: April 02, 2016, 10:37:48 am »
The serial communication would go to pin 3 and 4, with a TTL cable you could communicate with your Oak or you can use it to communicate with other connected device (like the GPS shield for example). I think they plan to implement a serial over the particle as well, but that is not ready yet.

For now to send text you can use particle.publish function, there is plenty of info on the particle web site describing all the functions, one important point is to check if you can use it on the oak, you can see what is usable here:
http://digistump.com/wiki/oak/tutorials/particle_reference


PeterF

  • Hero Member
  • *****
  • Posts: 881
Re: Where does Serial.write() go?
« Reply #2 on: April 02, 2016, 05:00:20 pm »
driffster is spot on. I just wanted to add that you don't need to include any libraries. All you do is do a 'Serial.begin(9600)' as usual for typical Arduino sketches, and then you'll be able to see the print, println and write serial messages via a USB to serial adapter (CH340, FTDI, or even an Arduino, etc) connected to pins 3 & 4.

defragster

  • Sr. Member
  • ****
  • Posts: 467
Re: Where does Serial.write() go?
« Reply #3 on: April 03, 2016, 02:14:38 am »
I'd suggest 'Serial.begin(115200)' as that is the default baud rate on power up [after passing through 74880 for the pre-preboot]- then you'll see any preboot/restart feedback should it become important - and less garbage perhaps when the bits won't byte.

PeterF

  • Hero Member
  • *****
  • Posts: 881
Re: Where does Serial.write() go?
« Reply #4 on: April 03, 2016, 02:43:06 am »
bits won't byte... nice one defragster! ;D And yes... sticking with the default is always a good idea... less changes the better.

digi_guy

  • Jr. Member
  • **
  • Posts: 87
Re: Where does Serial.write() go?
« Reply #5 on: April 03, 2016, 11:34:01 am »
It is possible to talk to/through the wifi module using Serial?

For example, if I wanted my Oak to get weather data from a webpage.

Or could I send a message over wifi to my Oak the way I could with the Pro+wifi?


PeterF

  • Hero Member
  • *****
  • Posts: 881
Re: Where does Serial.write() go?
« Reply #6 on: April 03, 2016, 09:08:04 pm »
You most certainly can - you would probably use Serial print/println to output serial messages,and Serial available/read/parse to get serial input. You would then need the appropriate code to respond to that serial input or output. ie., you might have it programmed so that it gets the current weather forecast when you send 'weatherForecast' via the serial, and it then reports back the forecast it has scraped from weather underground, etc via Serial. Or turn a light on when you send the 'lightOn' or 'lightOff' commands via serial. Or when IFTTT event triggers a publish message or function, your Oak could then send serial messages. Is that the sort of thing you were thinking of?