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.

xikky

Member Since 20 Feb 2012
Offline Last Active May 24 2012 07:40 AM
-----

Topics I've Started

Battery consumption

30 April 2012 - 03:07 PM

I have built a project which includes the following components:

Netduino Plus
Joystick + Board
Bluetooth
Accelerometer

My area is in software programming and thus I have no idea how many 9V batteries I need to power up these components together. Can somebody help me on this?

I would also appreciate if you tell me the method/formula used and what to look for.

Thank you!

Bluetooth Communication

21 March 2012 - 02:45 PM

Hello Netduino Community!

For my personal project, I am trying to communicate between my PC and Netduino, through Bluetooth. Hence I have attached BlueSMiRF Gold to Netduino, and a USB bluetooth dongle which I found laying around in my house, and which I attached to my PC.

When I came to implement the code, I realized that I have no understanding of how this works. I wish you to have some patience and explain to me what I am doing wrong and what I should be doing.

For my bluetooth testing this is what I am doing:

I have deployed this into my netduino:

    public class Program
    {
        static SerialPort serial;

        public static void Main()
        {
            // initialize the serial port for COM1 (using D0 & D1)
            serial = new SerialPort(SerialPorts.COM1, 115200, Parity.None, 8, StopBits.One);
            // open the serial-port, so we can send & receive data
            serial.Open();
            // add an event-handler for handling incoming data
            serial.DataReceived += new SerialDataReceivedEventHandler(serial_DataReceived);

            // wait forever...
            Thread.Sleep(Timeout.Infinite);
        }

        static void serial_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            // create a single byte array
            byte[] bytes = new byte[32];

            // as long as there is data waiting to be read
            while (serial.BytesToRead > 0)
            {
                // read a single byte
                serial.Read(bytes, 0, bytes.Length);
                // send the same byte back
                serial.Write(bytes, 0, bytes.Length);
            }
        }
    }

With this code from above, I am expecting that any data received from the BlueSMiRF is returned back.

I have opened a Windows Application to send data from PC to Netduino through Bluetooth, and this application also receives the data back. This is the code:

    public partial class Form1 : Form
    {
        public SerialPort serial;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // initialize the serial port for COM1 (using D0 & D1)
            serial = new SerialPort("COM6", 115200, Parity.None, 8, StopBits.One);
            // open the serial-port, so we can send & receive data
            serial.Open();

            serial.DataReceived += new SerialDataReceivedEventHandler(serial_DataReceived);
        }

        void serial_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            // create a single byte array
            byte[] bytes = new byte[32];

            // as long as there is data waiting to be read
            while (serial.BytesToRead > 0)
            {
                // read a single byte
                serial.Read(bytes, 0, bytes.Length);

                lblRecievedData.Text = bytes.ToString();
            }
        }

        private void btnSend_Click(object sender, EventArgs e)
        {
            System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();

            byte[] buffer = encoding.GetBytes(txtSendData.Text);
            
            serial.Write(buffer, 0, buffer.Length);
        }
    }

In a summary, this code lets the user fill a Textbox and click Send, to send data to Netduino. In return, Netduino should send the data back and this should be printed in the Label Control.

When I run the above code, the 'Connect' LED on the BlueSMiRF light up Green, so I am guessing that the connection is set up right. Data seems to be sent fine, since on debug, the byte[] buffer is filled appropriately. But the DataReceived Event is never accessed.

Please help me out on this. I searched on the internet, but I only found various ways to code Netduino to Send and Receive data through bluetooth. But not what to code to send data to Netduino from PC. Moreover, I am new to Netduino and hardware coding and I am feeling totally lost now.

Netduino as a Joystick Device

06 March 2012 - 12:24 PM

How can I make netduino to be read by the PC as a Joystick Device?

Joystick - Filtering Input

03 March 2012 - 12:36 PM

Do I need filtering for this Joystick? I really need some ideas and suggestions for Joysticks with netduino. I cannot find much on google.

I would really appreciate if someone shows me some code examples for joysticks.

Joystick and Bluetooth Module

25 February 2012 - 06:56 PM

I need to implement a joystick module Joystick1 + BreakoutBoard or Joystick2 to Netduino and a bluetooth module Bluetooth that will be used for communication between PC and Netduino. I have several questions before purchasing these items...

1. What is the difference between the two joysticks that I've put a link for? My personal preference is the first one since the other is out of stock and since I'm buying all the stuff from www.hwkitchen.com
2. Imp: How do I connect the joystick to the breakout board? Is the breakout board used to connect I/O device to a Development board?
3. And do you have any guides to share for me on how to connect and program these devices on the Netduino. Best I found for bluetooth is this Link (which I'm hoping RN-41 and RN-42 are no different to connect and program). I found nothing yet regarding the joystick. Please share with me some guides that you know on these two subjects as I'm still new on this.
4. And anyone bought from HW Kitchen before?

Thank you in advance :)

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.