User Tools

Site Tools


oak:tutorials:api_reference

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
oak:tutorials:api_reference [2016/04/08 13:04]
digistump created
oak:tutorials:api_reference [2016/10/27 19:13]
pfeerick reverting - wasn't right place to put last note.
Line 18: Line 18:
   * Particle.syncTime() - though time is not yet connected to anything   * Particle.syncTime() - though time is not yet connected to anything
  
 +
 +==== Controlling connection to Particle ====
 +
 +You can use the ''​SYSTEM_MODE()''​ function at the top of your sketch to control your Oak's connection to the Particle cloud, and can choose between three modes (Automatic, Semi-automatic and Manual). The default mode is Automatic, and your Oak will automatically attempt to connect to it's configured Wifi AP, and then try to establish a connection with the Particle cloud. You don't have to specify or do anything to make it do this. 
 +
 +''​SYSTEM_MODE(SEMI_AUTOMATIC)''​ will prevent the Oak from auto connecting to Particle (or auto attempting) - you'll need to call ''​Particle.connect()''​ to connect. It will however still attempt to establish a wifi connection, but that is all - it will not connect to Particle unless you explicitly tell it to. 
 +
 +''​SYSTEM_MODE(MANUAL)''​ will prevent the auto connect to Particle AND not automatically check particle for new data each loop when connected. This means you will need to use ''​Particle.process()''​ function reguarly in order maintain the connection to the Particle cloud, but means you have full control over your Oak, and can ensure that time-sensitive code is handled properly. ​
 +
 +Check out the [[https://​docs.particle.io/​support/​troubleshooting/​mode-switching/​photon/#​semi-automatic-mode|Particle guide on mode switching]] for more details.
 ===== ESP8266 API ===== ===== ESP8266 API =====
  
Line 23: Line 33:
 All of the [[http://​esp8266.github.io/​Arduino/​versions/​2.0.0/​doc/​libraries.html|ESP8266 2.0.0 APIs are available]] All of the [[http://​esp8266.github.io/​Arduino/​versions/​2.0.0/​doc/​libraries.html|ESP8266 2.0.0 APIs are available]]
  
-Some ESP8266 libraries that change the WiFi connection settings or state may break your Oak. So be prepared to break out a 3.3v USB to Serial adapter, and follow the recovery instructions to [[https://​github.com/​digistump/​OakRestore|restore your Oak]] if you mess with thouse!+Some ESP8266 libraries that change the WiFi connection settings or state may break your Oak. So be prepared to break out a 3.3v USB to Serial adapter, and follow the recovery instructions to [[https://​github.com/​digistump/​OakRestore|restore your Oak]] if you mess with those!
  
  
Line 33: Line 43:
  
 bool Oak.connected(void) - returns true if wifi is connected (even if particle is not) bool Oak.connected(void) - returns true if wifi is connected (even if particle is not)
 +
 bool Oak.waitForConnection(void) - loops until wifi connects or 15 seconds pass, returns true if connected at end bool Oak.waitForConnection(void) - loops until wifi connects or 15 seconds pass, returns true if connected at end
  
Line 61: Line 72:
 Commands are available via http, tcp, and serial. Commands are available via http, tcp, and serial.
  
-Additional ​commands ​added for the Oak:+Full list of commands ​implemented on the Oak are here[[oak:​tutorials:​internalurls|Oak Internal URLs]]
  
oak/tutorials/api_reference.txt · Last modified: 2017/01/30 14:00 by weaslyd