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.

nightlynx

Member Since 17 Aug 2010
Offline Last Active Aug 29 2010 04:11 AM
-----

Topics I've Started

Serial and VS 2010?

27 August 2010 - 02:24 AM

So I'm having an issue with VS 2010 trying to use the serial port of the Netduino to display to a matrix orbital lcd display. Intellisense isn't showing any errors in my code but when I go to deploy it to the board it has the following error at the bottom of the page:

Error 1 0x80131700 C:\Documents and Settings\Administrator\my documents\visual studio 2010\Projects\NetduinoApplication1\NetduinoApplication1\MMP NetduinoApplication1

I'm a total newb to C# and visual studio so maybe I'm doing something stupid but I don't know what the issue is. My code is:

using System;
using System.IO.Ports;
using System.Text;                              // UTF Encoding
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace NetduinoApplication1
{
    public class Program
    {
        static OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);

        //instantiate the serial port connection                           
        static SerialPort MyserialPort = new SerialPort("COM1",19200);

        public static void Main()
        {
            MyserialPort.Open();

            if (MyserialPort.IsOpen)
            {
                Debug.Print("Serial Port is open.");
            }

            InterruptPort button = new InterruptPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth);
            button.OnInterrupt += new NativeEventHandler(button_OnInterrupt);

            Thread.Sleep(Timeout.Infinite);
        }

        static void button_OnInterrupt(uint data1, uint data2, DateTime time)
        {
            // Set the led
            led.Write(data2 == 0);

            // Encode to UTF8
            UTF8Encoding enc = new UTF8Encoding();
            // Encode Byte array
            string tempString = "Button Press";
            byte[] tempData = enc.GetBytes(tempString);
            // Write to Serial Port
            int bytesWritten = MyserialPort.Write(tempData, 0, tempData.Length);

            Debug.Print("Bytes Written" + bytesWritten.ToString());
        }
    }
}

I did look at the document on adding the reference to Microsoft.SPOT.Hardware.SerialPort and I think I did it correctly. Do I need to add a Using statement for Microsoft.SPOT.Hardware.SerialPort as well? I tried it and it didn't like it so I left it out

Oh and I boosted the code from someone else on here so if it was you don't get mad :P

Thanks

Power output question

26 August 2010 - 03:25 AM

So the specs say the following: digital pins 2, 3, 7: 16 mA per pin analog pins 0-3: 2 mA per pin microcontroller max current: 200 mA total however does this include the power output pins for 5v and 3.3v on J6 pins 2 and 3? are they part of the microcontroller or a separate system and if so what's the max current they can output? I just want to be sure before I try and draw too much current through them. Thanks! ..and I stuck this in the wrong forum :( my bad

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.