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.

Bendage's Content

There have been 149 items by Bendage (Search limited from 19-May 23)


By content type

See this member's


Sort by                Order  

#23255 Netduino Serial Port Code Review

Posted by Bendage on 24 January 2012 - 10:16 PM in Project Showcase

So, without this extra component Netduino cannot communicate with built in serial like the Arduino? Disappointed :( I have a Sparkfun Xbee Explorer shield. This should do the trick right?



#23266 Netduino Serial Port Code Review

Posted by Bendage on 25 January 2012 - 03:12 AM in Project Showcase

I just tested and confirmed that YES the Sparkfun Xbee shield does in fact work in place of the FTDI shield he is using. Still kind of blows that serial is not built into the Netduino like it is in the Arduino. I've just never tried since we have debug writing to the console. By the way, Hari... you rock man. I love your contribution and detailed videos to this community. Thank you!



#23313 Netduino Serial Port Code Review

Posted by Bendage on 25 January 2012 - 06:14 PM in Project Showcase

Thank you for the clarification Chris. Do you have a link to what you are referring to? USB + HID does not return anything specific enough. Is there online docs maybe in the Arduino format or MSDN format for the Netduino?



#23321 What's the latest .NET MF and firmware?

Posted by Bendage on 26 January 2012 - 03:10 AM in Netduino Plus 2 (and Netduino Plus 1)

By any chance.... [Fingers crossed] 4.2 will support System.Collections.Generic?



#23323 Common Libraries

Posted by Bendage on 26 January 2012 - 04:14 AM in General Discussion

Hi, I have a question about .Net DLL's. I have a need to create a sharable library with a .Net Windows app and a Netduino app. If I stay in the bounds of the following references... System System.Collections System.Text System.Threading System.Xml System.Reflection Can I create a single dll used to be referenced in a Netduino app and a windows app?



#23324 Common Libraries

Posted by Bendage on 26 January 2012 - 04:18 AM in General Discussion

My apologies, I posted this in the wrong section.



#23329 Common Libraries

Posted by Bendage on 26 January 2012 - 04:53 AM in General Discussion

Hey Chris, Thanks for the late New York response. Working OT? I see a promotion in store! So, I am trying to read between the lines here... It is possible? You just don't recommend it?



#23330 Common Libraries

Posted by Bendage on 26 January 2012 - 05:00 AM in General Discussion

Ah... answered my own question. A dot net micro framework application will not compile referencing a dll not created under the micro framework regardless if referenced libraries are in both frameworks. They just aint the same :) Makes sense now. Thanks!



#23331 Drilling down to the StackFrame

Posted by Bendage on 26 January 2012 - 05:28 AM in Netduino Plus 2 (and Netduino Plus 1)

In the .Net Framework I have made a method for logging purposes in that the called method is able to determine who (what class/method) called it... // Get Log Stage string stage = ""; try { System.Diagnostics.StackFrame stackFrame; System.Reflection.MethodBase stackFrameMethod; string typeName; stackFrame = new System.Diagnostics.StackFrame(1, true); stackFrameMethod = stackFrame.GetMethod(); typeName = stackFrameMethod.ReflectedType.FullName; if (typeName.Trim().Length == 0) typeName = "Unknown"; if (typeName.IndexOf(".") > -1) { typeName = typeName.Substring(typeName.LastIndexOf(".") + 1); } stage = typeName + ":" + stackFrameMethod.Name; } catch (Exception expTrace) { Debug.WriteLine("Could not obtain log stage from stack. " + expTrace.Message); stage = "Unknown"; } I noticed in the micro framework that System.Diagnostics does not contain the StackFrame class. Perhaps it was placed somewhere else? Perhaps there is another way a method can determine the calling method?



#23332 Is that a Netduino Plus reading my mail?

Posted by Bendage on 26 January 2012 - 05:40 AM in Project Showcase

Nice! But does it speak them? Then I'd bow down! ;)



#23351 Netduino-compatible embedded webserver

Posted by Bendage on 27 January 2012 - 06:34 AM in Netduino Plus 2 (and Netduino Plus 1)

Looks like these are the only supported files... private static readonly Hashtable _supportedTypes = new Hashtable() { { ".htm", null }, { ".html", null }, { ".js", null }, { ".css", null }, { ".gif", null }, { ".jpg", null }, { ".png", null }, { ".bmp", null } }; Which still rocks! I doubt a netduino is going to parse PHP or asp pages on the server side with the lack of memory, but this far exceeds my expectations! Xml and txt would be good files to add. Nice job. I will be following this.



#23535 Serial framework Bug?

Posted by Bendage on 30 January 2012 - 10:38 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello, I am in the middle of creating an RFID reader library. Because of the design of the RFID reader it allows two modes: 1. Detection: Reader waits for a card to be scanned and sends data Asychronously using serial.datareceived. 2. Standby: Reader expects a card to be present to read and execute command and return instant data synchronously The problem is switching back and forth. When the library is initialized it is currently not connected to the rfid reader com port. Thus no serial object instantiated. Which is fine. Once the reader goes into detection mode a serial object is instantiated, initialized, and opened. This serial object being public to the class will stay open until standby mode it requested. public void DetectionMode() { _serialPort = new SerialPort(_comPort, BAUD_RATE, Parity.None, 8, StopBits.One); _serialPort.DataReceived += new SerialDataReceivedEventHandler(serialPort_DataReceived); _serialPort.Open(); _serialPort.Write(new byte[1] { 0x01 }, 0, 1); // tells reader to notify me when a card is present. _state = ReadState.DetectionMode; } The very first time the class uses detection mode, it works properly. All data gets received from the datareceived event handler. However when the user needs to initiate standby mode to execute advanced functionality, the public serial object (above) is killed and a private is opened to grab the quick synchronous data. Standby mode means I need to disconnect and kill the public serial port like this... if (_serialPort != null) { if (_serialPort.IsOpen) _serialPort.Close(); _serialPort.DataReceived -= serialPort_DataReceived; _serialPort.DiscardInBuffer(); _serialPort.DiscardOutBuffer(); _serialPort.Dispose(); _serialPort = null; } I really kill this sucker!!!!! Then I create a private serial port and immediately scan card for advanced reading. At this point I am good. Everything works as expected. Here is where it breaks... If detection mode is requested again and the datareceived event handler is re-initiated, it won't ever fire again... However I can re-instantiate a private serial object and use synchronous data transmission all day long. I just can't re-use the public one in asynchronous mode which I need for a card detection wait state. Is this a bug or am I doing something wrong with closing the old public serial reference?



#23539 Serial framework Bug?

Posted by Bendage on 30 January 2012 - 11:15 PM in Netduino Plus 2 (and Netduino Plus 1)

Chris, It's not the private port I have a problem with. Basically the problem is this... A public serial port that uses the datareceived event handler, once the object is used, set to null, and reinstantiated, the datareceived event handler no longer fires even though its initialized and opened.



#23541 Serial framework Bug?

Posted by Bendage on 30 January 2012 - 11:34 PM in Netduino Plus 2 (and Netduino Plus 1)

Fixed! Thread.Sleep is like duct tape!



#23640 Library for HC_SR04 Ultrasonic Rangefinder

Posted by Bendage on 01 February 2012 - 10:33 PM in Netduino 2 (and Netduino 1)

Someone might find this code useful. I found these HC SR04 ultrasonic rangefinders on amazon for $15 but they had no code. I found some Arduino code, but was pretty useless for Netduino because it used blocking for the timing. So I wrote my own that uses interrupts for the timing.

We used this successfully on a mobile robot for detecting obstacles. Accurate to sub-inch against hard surfaces. It is calibrated for my altitude and climate, you may need to adjust the InchConversionFactor and LatencyTicks for your environment. If you want it to read centimeters, just add your own TicksToCentimeters function.

Enjoy and feel free to improve it.



I did!

Thanks for sharing!



#23662 EasyDriver Class for Stepper Motors

Posted by Bendage on 02 February 2012 - 07:18 AM in General Discussion

I think this driver assumes that motor is 200 steps? Because my 400 step motor only does 180 degrees when I specify 360 but 200 step motor does the full 360. To keep this class black boxed... all public underline fields should be set to private. Also how to make it go faster/slower. I see a thread.sleep(1) but it is very slow when I can make my 400 step motor do over 3000 rpm with an arduino board and an easy driver. Other than that, good job. Very useful.



#23704 Delay microseconds

Posted by Bendage on 02 February 2012 - 11:03 PM in Netduino 2 (and Netduino 1)

Hey guys, Thread.Sleep is millis How to delay Netduino down to the microsecond?



#23705 6 degrees of freedom

Posted by Bendage on 03 February 2012 - 12:01 AM in Netduino 2 (and Netduino 1)

Hi Jacques, unfortunately I don't own one of those, just de ADXL345. I sincerely do hope you get some more useful answers then mine. But if not, from the info at Sparkfun (it is basically an ADXL345 accelerometer + ITG3200 gyro on the same breakout-board), it appears like you could start by using the info on the Loveelectronics site and get at least the accelerometer part working with your Netduino plus. From there hopefully you can extend their code to include the gyro output.



using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace accelerometer
{
public class Program
{
// Define our accelerometer inputs
static AnalogInput accX;
static AnalogInput accY;
static AnalogInput accZ;

public static void Main()
{
// Create the Inputs
accX = new AnalogInput(Pins.GPIO_PIN_A0);
accY = new AnalogInput(Pins.GPIO_PIN_A1);
accZ = new AnalogInput(Pins.GPIO_PIN_A2);

while (true)
{

Debug.Print("accX: " + accX.Read().ToString());
Debug.Print("accY: " + accY.Read().ToString());
Debug.Print("accZ: " + accZ.Read().ToString());
}
}
}
}



#23706 Delay microseconds

Posted by Bendage on 03 February 2012 - 12:11 AM in Netduino 2 (and Netduino 1)

Actually I just ended up writing one myself...

private void DelayMicroseconds(int microseconds)
{
    long delayTime = microseconds * 10;
    long delayStart = Utility.GetMachineTime().Ticks;
    while ((Utility.GetMachineTime().Ticks - delayStart) < delayTime) ;
}



#24238 How to use COM1 and COM2 together

Posted by Bendage on 14 February 2012 - 07:10 PM in General Discussion

Link is bad... http://www.netduino....duino/specs.htm Basically what you are looking for is this: digital pins 0-1: UART 1 RX, TX (COM 1) digital pins 2-3: UART 2 RX, TX (COM 2)



#24280 Infrared library for Netduino

Posted by Bendage on 16 February 2012 - 04:52 AM in Project Showcase

Hi Mario, Thank you for the nice demo. I see that you are referencing 2 libraries... InfraredTransmitter and InfraredCodecRC5. Based on your namespace I deduct that these libraries are included in the toolbox framework? I downloaded the latest and I'm not seeing them.



#24360 Speaker class and Netduino Keyboard

Posted by Bendage on 18 February 2012 - 01:48 AM in Project Showcase

Truly great stuff! Listening to an Adele midi converted by your PHP page. Wish you had a .Net class we could convert on the fly. But I ain't complaining. Thanks for sharing!



#24815 Creating Enum instances using Reflection

Posted by Bendage on 28 February 2012 - 05:28 PM in General Discussion

What namespace is the Parse command under for (MyEnum)Parse(typeof(MyEnum), "Due");

There is an Enum.Parse under the full framework but it does not exist under MF.

Trying to figure out how to parse an enum myself.



#24829 Convert.ToBoolean

Posted by Bendage on 28 February 2012 - 09:31 PM in Netduino 2 (and Netduino 1)

string test = "true"; bool test2 = (test.ToLower() == "true"); Since there is no Convert.ToBoolean, what is the solution?



#24831 Creating Enum instances using Reflection

Posted by Bendage on 28 February 2012 - 09:33 PM in General Discussion

I guess case statements have their place :P




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.