Tinymacrocosm - Viewing Profile: Topics - Netduino Forums
   
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.

Tinymacrocosm

Member Since 04 Oct 2014
Offline Last Active Dec 16 2014 09:00 PM
-----

Topics I've Started

Bytes sent over SerialPort not the same when received on Netduino over Bluetooth

25 October 2014 - 10:10 PM

I am working on a project and I am using this website as a reference to get my Netduino to communicate with my PC.

I've purchased this Bluetooth transceiver. It seems to be an updated version of the one used by the original post. 1.06 vs 1.04 on his website.

 

I set the Bluetooth's TXD to Pin0, RXD to Pin1, and VCC to 5V.

 

This is my code on the Netduino:

static SerialPort Bluetooth;

public static void Main()
{
    Bluetooth = new SerialPort(SerialPorts.COM1, 9600, Parity.None, 8, StopBits.One);
    Bluetooth.DataReceived += new SerialDataReceivedEventHandler(Bluetooth_DataReceived);

    Bluetooth.Open();

    Thread.Sleep(Timeout.Infinite);
}

static void Bluetooth_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
    byte[] bytes = new byte[1];

    while(Bluetooth.BytesToRead > 0)
    {
        Bluetooth.Read(bytes, 0, bytes.Length);
        Debug.Print(bytes[0].ToString());
    }
}

This is my code on my laptop: (it is a WPF application)

SerialPort serialBT;

private void Connect()
{
    // COM7 is the outgoing port that corresponds to the Bluetooth transceiver
    serialBT = new SerialPort("COM7", 9600, Parity.None, 8, StopBits.One);
    serialBT.Open();

    serialBT.Write(new byte[] { 23, 24, 25, 26 }, 0, 4);
    Debug.Print("Values sent");
}

On the Netduino, when I send the byte array of 23, 24, 25, and 26 (just for testing purposes), the DataReceived event fires. However the values it received and prints out in the debug window are 6, 0, 0, and 248 instead of the 23, 24, 25, and 26 that it should be.

 

Other values I send are also just as mysteriously transformed to completely different ones.

 

I've tripled checked the proper COM settings for the Bluetooth transceiver and those are the correct settings. I've flipped the TXD and RXD pins since the original Arduino expects TXD to be Pin1 and RXD to be Pin0, but that causes no data to be received on the Netduino.

 

Using COM2 and Pin2 and Pin3 yield different values. Instead, I get 0,16,16, and 16.


Help with recreating an Arduino project into Netduino

10 October 2014 - 08:08 PM

I am working on a project as an independent study with a professor. Part of it involves doing something very similar to what was done on this website: http://www.thebox.my...ED_Sensing.html. the actual instructions start about halfway through the page.

 

I am using a Netduino 1 running the 4.2.0 firmware.

 

I currently have the LED acting as a crude light sensor but the LED does not turn glow. His first instruction is:

 

First of all in the setup() you must globally disable the internal pull up resistors with:-

    _SFR_IO8(0x35) |= 0x10;   // global disable pull up resistors

If you don’t do this, then it won’t work at all.

 

I'm uncertain as to how can i disable the pull up resistor on the entire board. If not, I would settle for disabling it from the IO pin. But i dont see any way of doing so on either an OutputPort or an AnalogInput.

 

The rest of the instructions i am a little uncertain as to what exactly he means, though I will likely try to analyze his Arduino code and convert it to .NET.


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.