Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

NetDuino Plus 2 + Spark.io ?

NetDuino Plus 2 Spark.io Wireless control

  • Please log in to reply
4 replies to this topic

#1 TareqGamal

TareqGamal

    Member

  • Members
  • PipPip
  • 19 posts

Posted 09 June 2014 - 01:30 PM

I have NetDuino Plus 2 ,

and I tried the Ethernet control by cable

but I purchased Spark.io which control things using Wireless connection.

They said it is Netduino compatible ,

Is there any samples for using them together?

 

Thanks



#2 baxter

baxter

    Advanced Member

  • Members
  • PipPipPip
  • 415 posts

Posted 10 June 2014 - 03:50 AM

I don't think the Spark Core is Micro Framework compatible. You may have a bit of trouble connecting the hardware to a Netduino Plus 2. Maybe you could talk to it over the serial interface. Or perhaps, give your Netduino a wireless interface with an ethernet to wireless adapter ,

http://forums.netdui...-a-pc-wireless/



#3 EnergySmithe

EnergySmithe

    Member

  • Members
  • PipPip
  • 10 posts

Posted 27 June 2014 - 05:01 AM

Hi TareqGamal, after taking a quick look at the spark core I would have to agree with baxter... but I don't think thats necessarily a bad thing!  The spark core appears to essentially be a paired down arduino, so to connect the two you would have to do a bit of coding in both the Arduino framework and .NET for your N+2, but it has a hardware serial interface (RX,TX) that is voltage compatible (3.3v) with your Netduino, so hooking the two together physically will be easy enough.  I don't see why it wouldn't work, you could look for serial communication examples for both boards and just repurpose it for your needs.  Unfortunately there is probably not existing code samples unless you develop them yourself.  I am not sure where you saw that the Spark core is Netduino compatible, but if it was from their website then I would contact them directly about getting a code/wiring example...

 

Good luck TareqGamal!



#4 EnergySmithe

EnergySmithe

    Member

  • Members
  • PipPip
  • 10 posts

Posted 27 June 2014 - 05:04 AM

BTW, keep us in the loop on what you find out or end up doing, it looks like a fun project!



#5 baxter

baxter

    Advanced Member

  • Members
  • PipPipPip
  • 415 posts

Posted 27 June 2014 - 06:53 AM

I bought a Spark Core and it looks to be a nice companion to provide WiFi capability for a Mini or a Netduino 1 or 2 by talking over the serial port as EnergySmithe noted. There are two serial ports, serial and serial1. The former is the regular Arduino debug port to be used with a serial terminal and the latter would be used to talk to a Netduino. The IDE is cloud based with the same buttons as the Arduino IDE, verify, flash ... They also have an Android App to work with the pins and configure the core for your network. I found the following sample code for a webserver and it works like a charm. The only problem I see with it vs Netduino is shifting gears to program an Arduino.

TCPClient webClient;
TCPServer webServer = TCPServer(80);
char myIpAddress[24];
int LED = D7;

void setup() {
    pinMode(D7,OUTPUT);         // Turn on the D7 led so we know it's time
    digitalWrite(D7,HIGH);      // to open the Serial Terminal.
    
    Serial.begin(9600);

  // Now it's ok to open your serial terminal software, and connect to the
  // available COM port.  The following line effectively pauses your
  // application waiting for a character to be received from the serial
  // terminal.  While it's waiting it processes the background tasks to
  // keep your Core connected to the Cloud.  Press ENTER in your 
  // serial terminal to start your application.
  while(!Serial.available()) SPARK_WLAN_Loop();
  
    Spark.variable("ipAddress", myIpAddress, STRING);
    IPAddress myIp = Network.localIP();
    sprintf(myIpAddress, "%d.%d.%d.%d", myIp[0], myIp[1], myIp[2], myIp[3]);
    
    Serial.print("Spark Core connected to IP: ");
    Serial.println(myIp);
    digitalWrite(D7,LOW); // Turn off the D7 led ... your serial is serializing!
    
    webServer.begin();
}

void loop() {
    if (webClient.connected() && webClient.available()) {
        serveWebpage();
    }
    else {
        webClient = webServer.available();
    }
}

void serveWebpage() {
    //TODO: read in the request to see what page they want:
    //TODO: retrieve larger content from flash?

    webClient.println("<html>Hello I'm serving a webpage!</html>\n\n");
    webClient.flush();
    webClient.stop();
    delay(100);
}







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.