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/xbee code


  • Please log in to reply
1 reply to this topic

#1 JWills

JWills

    New Member

  • Members
  • Pip
  • 7 posts

Posted 23 October 2012 - 02:47 AM

This will be easy mode for most of you, I have a set of xbee usb wireless moduls. A Net-mini. All I want to do is get some examples of the code to read from my computer to the xbee mods, and turn on an LED on my Net-mini, Can anyone send we some good links on doing this, I just need full code for the net-Mini, not the PC side of that. Its working good. I can't figure out the code I need to put in the net-Mini to read and execute the LED. Thanks

#2 awaiK

awaiK

    Advanced Member

  • Members
  • PipPipPip
  • 90 posts

Posted 23 October 2012 - 08:24 AM

Hm, the PC-side code and the netduino code should be smiliar.

You need to connect the XBee to netduino's TTL-level serial port.
Open the serial port and listen to the proper bytes on which you want to switch the LED.

private static SerialPort serialPort;
private OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);

public static void Main()
{
	serialPort = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
	serialPort.Open();
	serialPort.DataReceived += new SerialDataReceivedEventHandler(serialPort_DataReceived);
	
	Thread.Sleep(Timeout.Infinite);
}

private static void serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)  {
	// Read the bytes and switch LED
        led.Write(true);
}





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.