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.

bill.french's Content

There have been 260 items by bill.french (Search limited from 07-June 23)


By content type

See this member's


Sort by                Order  

#7645 NetDuino Quadrocopter

Posted by bill.french on 14 January 2011 - 02:04 PM in Netduino 2 (and Netduino 1)

Is this evidence of the "issue" - or is it just a precision issue with the Saleae Logic Probe? Notice the highlighted gaps, which are regularly repeating.

I used this code:
namespace TightLoopTest1
{
    public class Program
    {
        public static void Main()
        {
            OutputPort d2 = new OutputPort(Pins.GPIO_PIN_D2, false);
            bool status = false;
            while (true)
            {
                status = !status;
                d2.Write(status);
            }


        }

    }
}

and got this @ 24Mhz:
Posted Image



#7636 Question about COM2

Posted by bill.french on 14 January 2011 - 06:05 AM in Netduino 2 (and Netduino 1)

Staring at Tecchie's Pinout Cards tonight, a question popped in my head:

If you are using COM2, are D7 and D8 (rts/cts) unusable for anything else? Or can the still be assigned as input/output ports?



#7603 If you were to get two netduinos to talk to each other, what would you use?

Posted by bill.french on 13 January 2011 - 09:04 PM in Netduino 2 (and Netduino 1)

Very close distance. Serial is definately easy. I guess my one concern with serial is that there's only two uarts, and point-to-point, so they are kind of "precious". Hmmm....



#7596 If you were to get two netduinos to talk to each other, what would you use?

Posted by bill.french on 13 January 2011 - 08:31 PM in Netduino 2 (and Netduino 1)

If you had two netduinos in very close proximity, what protocol would you use to connect them? SPI, uart, I2C? Something else? Why? I guess I'm looking for what would be the easiest way to do it, and would tie up the least valuable resources.



#7572 Interfacing with the uLCD-144 mini lcd screen

Posted by bill.french on 13 January 2011 - 01:16 PM in Netduino 2 (and Netduino 1)

That looks cool! But how did you get the netduino icon to appear on the display?

I was going to post it, but it's huge. I wrote this method (see above):

public void drawbitmap(byte[] bmp)

... and passed it in a static readonly byte array, a trick I learned from your fluent interopt stuff. I modified my c# code generator to do (byte) instead of (short), and had it read from a 8 bit bitmap file i generated from one of the 4D tools. I'll post more of a snippet tonight. I also have text working, but there's lots more work to do -- for instance, feeding it a file off the netduino SD card, or interfacing with the screen's SD card.



#7521 Interfacing with the uLCD-144 mini lcd screen

Posted by bill.french on 12 January 2011 - 05:46 PM in Netduino 2 (and Netduino 1)

I was introduced to this lcd in this thread: http://forums.netdui...ch__1#entry7229 -- and I got it working:

Posted Image

It's a 128x128 1.44" color LCD, with a serial interface and a "graphics processor" attached. Sparkfun has them for about $32. One of the comments from the Sparkfun page:

So let me get this straight. This thing is a color LCD with built in controller, backlight circuitry, microSD socket which is compatible with both low capacity and high capacity cards, AND! it basically has a user programmable microcontroller with 10k of program space and 2 GPIO lines in addition to all the on-board control lines for interfacing with the LCD?


The product pages are here: uLCD-144(GFX)

4D has two versions: GFX and SGC. GFX is basically a "standalone" version, meaning you program the built in controller directly, and can built an interface to whatever you want (netduino, pic, etc -- but you have to write the interface)

SGC is more like a "traditional" serial display, where you send it command like "draw a circle here", "display this text", etc.

At first I thought the difference was actually in the hardware, but it's not: it's just firmware. You can reflash the GFX to the SGC and back without any trouble. You can get the SGC firmware here.

I was able to power, test, flash, and program it using the 3.3v Sparkfun FTDI breakout via a breadboard, in spite of the board requiring 5v. I did have to manually toggle the reset line, but it was flawless, otherwise.

Here is the start of the class I'm building to interface with it:
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
using System.IO.Ports;

namespace uLCD_144_Test1
{
    class uLCD_144
    {
        public SerialPort _COM2;
        public void init()
        {
            using (OutputPort d4 = new OutputPort(Pins.GPIO_PIN_D4, true))
            {
                d4.Write(false);
                d4.Write(true);
            }
            Thread.Sleep(2000);
            this.write(new byte[] { (byte)0x55 });
        }
        public void drawbitmap(byte[] bmp)
        {
            //2.2.5 Draw Image-Icon - 49hex
            //Command cmd, x, y, width, height, colourMode, pixel1, .. pixelN
            byte[] cmd = new byte[] { (byte)0x49, (byte)0x00, (byte)0x2A, (byte)0x80, (byte)0x28, (byte)0x08 };
            this.write(cmd, false);
            this.write(bmp);
        }

        public void write(byte[] ba, bool pause = true)
        {
            if (this._COM2.IsOpen)
            {
                this._COM2.Write(ba, 0, ba.Length);
                int sleeptime = (ba.Length / 14) + 1;  //(calculate transmission time, at 115200, it can send 14 bytes / ms
                Debug.Print(sleeptime.ToString());
                if (pause)
                {
                    Thread.Sleep(sleeptime);
                }
            }
            else
            {

            }
        }
        public uLCD_144()
        {
            this._COM2 = new SerialPort(SerialPorts.COM2, 115200);
            this._COM2.Open();
            this.init();
        }
    }
}



#7513 Little Hydraulic Arm

Posted by bill.french on 12 January 2011 - 02:21 PM in General Discussion

This thread was the first thing I could think of: http://forums.netdui...ch__1#entry5873



#7512 Wild idea for a group project

Posted by bill.french on 12 January 2011 - 02:19 PM in General Discussion

my point is that I think an ND+ could (should?) play the role of the server. I do agree that most of the ND+ should be as bare bones as possible, so blinking an LED is a great starting point.



#7509 StepGenie (An EE's Best friend?)

Posted by bill.french on 12 January 2011 - 12:10 PM in Netduino 2 (and Netduino 1)

OK, here's a video of the stepgenie in action using LEDs:
http://www.youtube.com/watch?v=KjkVbNI8YBI
The code looks like this:
        public static void Main()
        {
            OutputPort d0 = new OutputPort(Pins.GPIO_PIN_D0, false);
            while (true)
            {
                d0.Write(true); //send a "step" to the StepGenie -- basically just a pulse
                d0.Write(false);
                Thread.Sleep(250);

            }
        }

It's wired up like this:
pins 1,2,12 -> 5v (from netduino)
pins 3,13,14 -> ground (from netduino)
pins 5,6,7,8 -> 220ohm resistor -> led -> ground
pin 11 -> D0 on the netduino

With this setup, you can move pin 12 from 5v to Gnd to switch directions; pins 2,3 can be moved to try different modes. Or, connect them up to digital ios on the netduino and change them through programming.

Hard to follow picture of the circuit: (I ran out of 220 ohm resistors so I used a blue potentiometer on one of the leds...)
Posted Image



#7507 Wild idea for a group project

Posted by bill.french on 12 January 2011 - 11:12 AM in General Discussion

I have'mentioned in the my previous reply, we can get the led params from the link. So why do we even need the firewall stuff??
I am realy busy this week so I guess I'll have to wait couple of days more to get hands on..

Vincent

My concern with your link is that it involves using an extra server to store and pass data that is not an netduino -- i think we should keep it as purely about the netduino plus as possible.



#7506 SparkFun LCD Backpack

Posted by bill.french on 12 January 2011 - 11:10 AM in General Discussion

Do you have code you can post, or you're not sure even how to start with code? I'm thinking it is going to work fine w/o 5v ttl -- the "5v tolerant" means the netduino can tolerate 5V *input* -- output is going to be 3.3v. Check out the code attached to this post: http://forums.netdui...ch__1#entry5962 ...it's the best I have for serial communication.



#7465 Graphing Data from Netduino over the network

Posted by bill.french on 11 January 2011 - 05:42 PM in Netduino Plus 2 (and Netduino Plus 1)

You know, I have not had the problem, since, so I have not turned my attention back to it. I really, really, want to get my head around sockets and threads in .net. I used to have a handle of it under Java, but that was too long ago. Are you having the issue with my code, or your own?



#7462 Wild idea for a group project

Posted by bill.french on 11 January 2011 - 04:06 PM in General Discussion

@bill.french: To access a Netduino behind a firewall check out http://yaler.org/


That is cool -- i think for this project, that might be cheating -- I think we'd need to get an ND+ playing the role of Yaler.



#7461 Use of Static Keyword

Posted by bill.french on 11 January 2011 - 04:03 PM in General Discussion

Cool, thanks, Chris. This is somewhat related: is there a "cheat sheet" anyone likes on styling code? Stuff like when to use camel case, lower case, etc, for methods, properties, classes, etc? ... and also, what's the current philosophy on namespaces?



#7454 StepGenie (An EE's Best friend?)

Posted by bill.french on 11 January 2011 - 02:09 PM in Netduino 2 (and Netduino 1)

Hey there. I just noticed your private message, sorry! I also stumbled across my step genie still setup w/ LEDs in a breadboard; i will post a picture tonight for you.



#7453 Use of Static Keyword

Posted by bill.french on 11 January 2011 - 02:07 PM in General Discussion

Very cool, thank you all -- sorry to hijack. I wish this were a separate thread!



#7417 Solid Graphic LCD

Posted by bill.french on 10 January 2011 - 03:19 PM in Netduino 2 (and Netduino 1)

2 things -- I believe your can "reflash" the SGC to GFX and vice-versa, based on this reply from 4D's support:

Certainly you can change the configuration from SGC to GFX and vice versa. See the links below with individual configurations,


Also, another screen to consider if anyone stumbles across this thread:
http://www.dfrobot.c...&product_id=135



#7411 Use of Static Keyword

Posted by bill.french on 10 January 2011 - 12:59 PM in General Discussion

Ever since the beginning of time ... or at least since version 0.9 of .NET, all Microsoft Templates has started out GUI projects with creating an "instance" of your main class.
...
The statement about "static" functions beeing stateless and without side effects, is a general rule of proper coding style.


I understand what static is. I'm looking more for literature that supports what sounds a lot like your opinion. Based on what you say, if I have a function that I want only ever want one instance of, unless it's a helper function or without side effects, I should not make it static -- that doesn't quite sit well with my gut, but I really don't know.

Concerning your gui / java example, I (think I) know the templates were that way because they *had* to be, since main has to be static (there can be only one) and you can't call non-static functions or whatever.

"rules of proper coding style" -- where are these rules? I've used static classes to specifically deal with certain state issues.

As I'm writing this, it seems combative, but I really want to understand.



#7388 Wild idea for a group project

Posted by bill.french on 10 January 2011 - 01:54 AM in General Discussion

time zones too...

I'm more concerned about firewalls.



#7383 Wild idea for a group project

Posted by bill.french on 10 January 2011 - 12:57 AM in General Discussion

This is an interesting idea! Even if all we did was turn on an LED, and pass it around (Jonny sends a signal to my ND+ which turns on an LED, and I send a signal to Omar's which turns on his LED, etc), and captured it on video, it would be VERY interesting.

This is simple and doable. Sign me up. Pick a date!



#7348 Analog in put C# coding

Posted by bill.french on 09 January 2011 - 06:32 PM in General Discussion

the line with the a5.read, I convert to a string, I believe it normally returns a number, so if you did something like:

int i = a5.read();
if (i > 20)
{
// do whatever
}

If you want to get the analog readings in mV, search the forums for "setrange".



#7346 Analog in put C# coding

Posted by bill.french on 09 January 2011 - 05:01 PM in General Discussion

I am not sure how much is left after the Netduino have taken it´s share from the regulator.

/Jan Olof


Should be plenty! And yes, debug.print should put stuff in the "output" window -- it should be in the lower left, although you might have to select the "output" tab. I can't remember, I set it up my visual studio layout some time ago, and the settings stick.



#7340 Analog in put C# coding

Posted by bill.french on 09 January 2011 - 02:40 PM in General Discussion

That's a cool little car. Is this all you're looking for, to test? Hook up 3.3v to aref, and the analog output from the sensor to A5 (plus whatever else the sensor needs, like power and ground), and i think you'll be all set to test.

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


namespace NDP_SocketSender1
{
    public class Program
    {
        public static void Main()
        {
       
            AnalogInput a5 = new AnalogInput(Pins.GPIO_PIN_A5);

            while (true)
            {
                string s = a5.Read().ToString();
                Debug.Print(s);
                Thread.Sleep(100);
            }
        }
    }
}

The above code is from here.



#7339 Fluent Interop 1.0

Posted by bill.french on 09 January 2011 - 02:33 PM in Project Showcase

Wow, Corey, that's amazing. So many potential uses!

You must have something already, but in case it somehow helps you even a little bit with making an 'offline' compiler, I wrote a simple function (wrapped in a console app for testing) that takes in a short[] and outputs text that can be easily cut and pasted into VS. It was fun for me to write, regardless.

using System;
using System.Text;

namespace ArrayOfShortsToText
{
    class Program
    {
        public static string AOStoText(short[] aos, string name = "compiledCode")
        {
            string nl = Environment.NewLine;
            string result = @"private static readonly short[] " + name + "=unchecked(new[] {" + nl;
            int count = 0;
            foreach (short i in aos)
            {
                result += @"(short)0x" + i.ToString("X4");
                count++;
                if (count < aos.Length)
                {
                    result += ", ";
                    if ((count % 5) == 0)
                    {
                        result += nl;
                    }
                }

            }

            result += nl + @"});" + nl;
            return result;
        }

        static void Main(string[] args)
        {

            short[] compiledCode = unchecked(new[] {
                (short)0xB5F0, (short)0xB086, (short)0x9005, (short)0x9104, (short)0x9E13, (short)0x9603, (short)0x9E17, (short)0x9602,
                (short)0x2600, (short)0x9601, (short)0xE027, (short)0x9801, (short)0x1E40, (short)0x9E01, (short)0x4046, (short)0x9600,
                (short)0x9901, (short)0x2200, (short)0xE019, (short)0x9E00, (short)0x2701, (short)0x1C33, (short)0x403B, (short)0x2B00,
                (short)0xD00E, (short)0x2701, (short)0x1C0B, (short)0x403B, (short)0x9E02, (short)0x6874, (short)0xB44F, (short)0x9802,
                (short)0x0080, (short)0x9E08, (short)0x5830, (short)0x9903, (short)0xF000, (short)0xF815, (short)0x1C07, (short)0xBC4F,
                (short)0x9E00, (short)0x1076, (short)0x9600, (short)0x1049, (short)0x1C52, (short)0x9F05, (short)0x42BA, (short)0xDBE2,
                (short)0x9E01, (short)0x1C76, (short)0x9601, (short)0x9E01, (short)0x9F04, (short)0x42BE, (short)0xDBD3, (short)0xB006,
                (short)0xBCF0, (short)0xBC02, (short)0x4708, (short)0x4720
              });
            Console.WriteLine();
            Console.Write(AOStoText(compiledCode, "TEST"));
        }
    }
}



#7337 Problem with Analog Input

Posted by bill.french on 09 January 2011 - 01:46 PM in Netduino Plus 2 (and Netduino Plus 1)

cwbhx: here's a thread with a diagram including a potentiometer, if it's helpful.




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.