Author Topic: Digispark Pro WiFi Shield Example Code  (Read 3703 times)

DanDawson

  • Newbie
  • *
  • Posts: 1
Digispark Pro WiFi Shield Example Code
« on: December 11, 2014, 03:20:44 pm »
I received my Digispark Pro and the Pro WiFi Shield today and a few minutes of soldering has them both ready to go.

The Pro WiFi Shield Wiki (http://digistump.com/wiki/digispark/tutorials/prowifi) gave me everything I needed to get it put together, but at this point I'm unable to find any example code to try to use it.

Has anyone been successful in using it, and if so, would you be willing to post the code to the Wiki, or here and I'll move it over to the Wiki and add any relevant information as I attempt the process myself.

digi_guy

  • Jr. Member
  • **
  • Posts: 87
Re: Digispark Pro WiFi Shield Example Code
« Reply #1 on: December 17, 2014, 11:06:23 am »
I've been able to make a small amount of progress on this.  The two problems I run into are that 1) most code for arduino uses wifi.h to simpify a lot of things and 2) a lot of similar documentation is for the ESP8266 Serial-to-WiFi Module which is similar but has a different sent of command codes.

First thing to note is that when the module is powered up it will create a wireless access point called USR-WIFI232-T, you can connect directly to it, and go to it's default config page at 10.10.100.254 (usr/pw admin/admin).  From here you can turn on the STN mode and enter in your home's wifi information (ssid, password, etc).  After restarting the module it will connect to your home network, and if you go to its ip address you'll get the same config page. 

The next thing I did was to use my ttl cable from adafruit http://www.adafruit.com/products/954 and plugged in directly to the module.  Using putty I was able to talk directly with it.

If you type '+++' and then 'a' the module will respond with an 'a' and an 'ok', then you'll be in the command mode.  From here you can type AT+H to see a list of the different commands.

Now type AT+WANN to see that the module is connected to your wifi, and make note of the ip addresss.

Next, type AT+NETP=tcp,server,8080,[the ip from above]

Lastly, type in AT+Z to restart the module and save the settings. 

Now things get kind of interesting. After restarting I can use putty again to telnet into the module's ip address and port number (entered above).  In theory this acts as a basic serial port.

At this point I've been able to write some basic serial scripts on the Pro and send messages, but that's as far as I've gotten.  In theory I should be able to write:
Code: [Select]
          Serial.println("HTTP/1.1 200 OK");
          Serial.println("Content-Type: text/html");
          Serial.println("Connection: close");  // the connection will be closed after completion of the response
          Serial.println("Refresh: 5");  // refresh the page automatically every 5 sec
          Serial.println();
          Serial.println("<!DOCTYPE HTML>");
          Serial.println("<html>");
          Serial.print("Home page ");
          Serial.println("<br />");
          Serial.println("</html>");
Add see "Home page" on a web browser but that hasn't worked yet. 

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Digispark Pro WiFi Shield Example Code
« Reply #2 on: December 17, 2014, 04:57:34 pm »
« Last Edit: December 18, 2014, 04:55:21 pm by digistump »