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.

qsnapper's Content

There have been 8 items by qsnapper (Search limited from 30-March 23)


By content type

See this member's

Sort by                Order  

#54193 Morse code to Text to Speach

Posted by qsnapper on 20 November 2013 - 03:21 PM in Project Showcase

- .... .- -. -.- ... / .--. .- ..- .-..




#54173 Morse code to Text to Speach

Posted by qsnapper on 19 November 2013 - 05:24 PM in Project Showcase

Hi All,

 

Thought I'd share my first self invented project after completing the standard blinking lights tutorials.

 

 

Translate button pushed to text, then post the text into a Firebase database, which then pushes the update to a static HTML page, I then grab the text and send that to Google's Text to Speech API and play what's returned in the HTML 5 Audio element.

 

Firebase is pretty neat, just was a pain as the API only accepts HTTPS posts and from what I understand the Netduino it's capable of doing that. So had to put some code up on a server which relays my post.




#53929 Simple HTTP Client?

Posted by qsnapper on 09 November 2013 - 01:18 PM in General Discussion

The API I am trying to work with only allows HTTPS GET requests.

Can someone help me out how I could change the above to get it to work with an HTTPS URL.

 

Thanks




#53927 Simple HTTP Client?

Posted by qsnapper on 09 November 2013 - 12:37 PM in General Discussion

lot of digging around found some sample code that works for me, hopefully works for you too.

Be sure to add the 'System.Http' reference. For some reason this doesn't work for HTTPS URL's though

using System;using System.IO;using System.Text;using System.Net;using System.Net.Sockets;using System.Threading;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.Netduino;namespace NetduinoApplication2{    public class Program    {        public static void Main()        {            // write your code here            // produce request            var requestUri = "http://192.168.1.1/?a=1";            Debug.Print(requestUri);            using (var request = (HttpWebRequest)WebRequest.Create(requestUri))            {                request.Method = "GET";                // headers                request.Headers.Add("X-ApiKey", "ThisIsMyKey");                // send request and receive response                using (var response = (HttpWebResponse)request.GetResponse())                {                    // consume response                    HandleResponse(response);                }            }        }        public static void HandleResponse(HttpWebResponse response)        {            // response status line            Debug.Print("HTTP/" + response.ProtocolVersion + " " +                        response.StatusCode + " " +                        response.StatusDescription);            // response headers            string[] headers = response.Headers.AllKeys;            foreach (string name in headers)            {                Debug.Print(name + ": " + response.Headers[name]);            }            // response body            var buffer = new byte[(int)response.ContentLength];            Stream stream = response.GetResponseStream();            int toRead = buffer.Length;            while (toRead > 0)            {                // already read: buffer.Length - toRead                int read = stream.Read(buffer, buffer.Length - toRead, toRead);                toRead = toRead - read;            }            char[] chars = Encoding.UTF8.GetChars(buffer);            Debug.Print(new string(chars));        }    }}



#53904 Simple HTTP Client?

Posted by qsnapper on 08 November 2013 - 05:39 PM in General Discussion

have exactly the same question! 




#42936 CIRC-06 | Music With Piezos Netduino Plus 2 MS Port

Posted by qsnapper on 07 January 2013 - 09:17 PM in Netduino Plus 2 (and Netduino Plus 1)

If anyone having the same issue, the below is the updated working code for Microsoft.SPOT.Hardware.PWM

 

using System;                               //use base classes                            using System.Threading;                     //use threading classes        using Microsoft.SPOT;                       //use smart personal objects technology classesusing Microsoft.SPOT.Hardware;              //use hardware related SPOT classesusing SecretLabs.NETMF.Hardware;            //use Secret Labs hardware frameworkusing SecretLabs.NETMF.Hardware.Netduino;   //use the Netduino specific classesnamespace Piezo{    public class Program    {        //static PWM speaker = new PWM(Pins.GPIO_PIN_D9);  // Add the following line instead of this one        static PWM speaker = new Microsoft.SPOT.Hardware.PWM(PWMChannels.PWM_PIN_D9, 100000, 0.5, false);        static char[] notes = "ccggaagffeeddc ".ToCharArray();        static int[] beats = { 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 4 };        static int tempo = 300;        public static void Main()        {            speaker.Start();        // Add this            while (true)            {                for (int i = 0; i < notes.Length; i++)                {                    playNote(notes[i], beats[i] * tempo);                    playNote(' ', tempo / 2);                }            }        }        /// <summary>        /// Plays a particular tone for a particular duration        /// </summary>        /// <param name="tone">The tone to play</param>        /// <param name="duration">How long to play the tone</param>        static void playTone(int tone, int duration)        {            //speaker.SetPulse((uint)(tone * 2), (uint)tone);     //Uncomment this nad use the next two lines instead            speaker.Period = (uint)tone * 2;            speaker.Duration = (uint)tone;            Thread.Sleep(duration);                             //waits the appropriate amount of time        }        /// <summary>        /// Looks up the tone for a note based on it's letter and plays        /// it for a specific amount of time        /// </summary>        /// <param name="note">The letter of the note to play</param>        /// <param name="duration">How long to play the tone</param>        static void playNote(char note, int duration)        {            char[] names = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C', ' ' };    //The array of possible notes            int[] tones = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956, 0 };//The frequency of each note in the previous array            for (int i = 0; i < 9; i++)     //Goes through each note            {                if (names[i] == note)                {                    playTone(tones[i], duration); //Plays the right note                }            }        }    }}



#42889 Netduino Plus 2 Firmware v4.2.1 (Update 2)

Posted by qsnapper on 06 January 2013 - 09:16 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi Chris,

 

Hi Jeff,

 

 

When you plug in your board, does it show up in Device Manager?  Under USB, as a Netduino?

 

If not, please try erasing and re-flashing your board to get it back into a known-good-state.  Instructions are in the firmware sticky at the top of the forum.

 

BTW, what does your PWM code look like?

 

Chris

 

I had pretty much the same experience as JeffJohnson (although I am using VS Express 2012, and it didn't crash). Couldn't get the Netduino Plus 2 to do anyting anymore. Re-flashing got my Netduino working again, ran the code and same issue. I skipped the PWM example, the code of which is: http://nedx.org/src/...R01-MB-code.txt

 

Then wanted to try another example which also includes PWM (code here: http://nedx.org/src/...NCIR06-code.txt) and that also had the same effect. 

 

Then read your 2nd post in this thread saying "The legacy ... SecretLabs.NETMF.Hardware.PWM classes have been replaced by ... Microsoft.SPOT.Hardware.PWM classes". Removed the SecretLabs MWM class and added the Microsoft one, but in VS get this error 

"Error 1 'Microsoft.SPOT.Hardware.PWM' does not contain a constructor that takes 1 arguments"

 

Any tips on how to get this working?

 

Thanks,

 

Quintus




#42663 News about Visual Studio 2012 .NETMF Support ?

Posted by qsnapper on 03 January 2013 - 09:45 PM in Visual Studio

Just received my Netduino Plus 2 today and it's my first dabble with electronics. Started learning a bit of C# + Web Pages 2 this summer for developing websites and starting to get the hang of that.

 

This evening been trying to get my first - and what I thought would be an easy - start project running, the BlinkingLed.

 

What do I have installed:

  • Windows 7
  • Visual Studio Express 2012 for Windows Desktop
  • MS .NET Microframework 4.3
  • Netduino SDK v4.2.1.0 (32-bit)

To start the project I did as above, started a c# console application and then manually added the Microsoft.SPOT.Hardware and 

SecretLabs.NETMF.Hardware.NetduinoPlus references.
 
The code written can be seen below the attached image.
Posted Image
I also did set the Target Framework to "4.2" as mentioned above. The Netduino was also detected correctly when I first plugged it in.
 
When I start debugging, I don't get any error messages, but my Netduino's LED doesn't start blinking either. 
If I push the button on the Netduino the light does light up, not sure if that's what it does out the box or not.
 
Not sure if this helps at all, but this is what is in my Output Debug console in VS was:
Found debugger!Create TS. Loading start at 806a238, end 8085f74Assembly: mscorlib (4.2.0.0)Assembly: Microsoft.SPOT.Native (4.2.0.0)Assembly: Microsoft.SPOT.Hardware (4.2.0.0)Assembly: Microsoft.SPOT.Net (4.2.0.0)Assembly: System (4.2.0.0)Assembly: Microsoft.SPOT.Hardware.SerialPort (4.2.0.0)Assembly: Microsoft.SPOT.IO (4.2.0.0)Assembly: System.IO (4.2.0.0)Assembly: Microsoft.SPOT.Hardware.PWM (4.2.0.1)Assembly: Microsoft.SPOT.Hardware.Usb (4.2.0.0)Assembly: SecretLabs.NETMF.Diagnostics (4.2.0.0)Assembly: SecretLabs.NETMF.Hardware.Netduino (4.2.1.0)Assembly: Microsoft.SPOT.Hardware.OneWire (4.2.0.0)Assembly: Microsoft.SPOT.Time (4.2.0.0)Loading Deployment Assemblies.Attaching deployed file.Assembly: Microsoft.SPOT.Graphics (4.2.0.0)Attaching deployed file.Assembly: BlinkingLed (1.0.0.0)Attaching deployed file.Assembly: SecretLabs.NETMF.Hardware.NetduinoPlus (4.2.0.1)Resolving.The debugging target runtime is loading the application assemblies and starting execution.Ready.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program FilesMicrosoft .NET Micro Frameworkv4.2Assemblieslemscorlib.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program FilesMicrosoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Native.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program FilesMicrosoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Hardware.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program FilesMicrosoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Net.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program FilesMicrosoft .NET Micro Frameworkv4.2AssembliesleSystem.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program FilesMicrosoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Hardware.SerialPort.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program FilesMicrosoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.IO.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program FilesMicrosoft .NET Micro Frameworkv4.2AssembliesleSystem.IO.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program FilesMicrosoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Hardware.PWM.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program FilesMicrosoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Hardware.Usb.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program FilesSecret LabsNetduino SDKAssembliesv4.2leSecretLabs.NETMF.Diagnostics.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program FilesSecret LabsNetduino SDKAssembliesv4.2leSecretLabs.NETMF.Hardware.Netduino.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program FilesMicrosoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Hardware.OneWire.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program FilesMicrosoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Time.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program FilesMicrosoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Graphics.dll', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:UsersQDocumentsVisual Studio 2012ProjectsNetduinoBlinkingLedBlinkingLedbinDebugleBlinkingLed.exe', Symbols loaded.'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:Program FilesSecret LabsNetduino SDKAssembliesv4.2leSecretLabs.NETMF.Hardware.NetduinoPlus.dll', Symbols loaded.The thread '<No Name>' (0x2) has exited with code 0 (0x0).The program '[6] Micro Framework application: Managed' has exited with code 0 (0x0).

 

And the Output console for Micro Framework Device Deployment was:

Looking for a device on transport 'USB'Starting device deployment...Iteration 0Opening port ?USB#VID_22B1&PID_1000#000000000000#{09343630-a794-10ef-334f-82ea332c49f3}OperationsAttaching debugger engine...... debugger engine attached!Querying device assemblies...Found Assembly mscorlib 4.2.0.0Found Assembly Microsoft.SPOT.Native 4.2.0.0Found Assembly Microsoft.SPOT.Hardware 4.2.0.0Found Assembly Microsoft.SPOT.Net 4.2.0.0Found Assembly System 4.2.0.0Found Assembly Microsoft.SPOT.Hardware.SerialPort 4.2.0.0Found Assembly Microsoft.SPOT.IO 4.2.0.0Found Assembly System.IO 4.2.0.0Found Assembly Microsoft.SPOT.Hardware.PWM 4.2.0.1Found Assembly Microsoft.SPOT.Hardware.Usb 4.2.0.0Found Assembly SecretLabs.NETMF.Diagnostics 4.2.0.0Found Assembly SecretLabs.NETMF.Hardware.Netduino 4.2.1.0Found Assembly Microsoft.SPOT.Hardware.OneWire 4.2.0.0Found Assembly Microsoft.SPOT.Time 4.2.0.0Found Assembly Microsoft.SPOT.Graphics 4.2.0.0Found Assembly BlinkingLed 1.0.0.0Found Assembly SecretLabs.NETMF.Hardware.NetduinoPlus 4.2.0.1Adding pe file C:Program FilesMicrosoft .NET Micro Frameworkv4.2AssembliesleMicrosoft.SPOT.Graphics.pe to deployment bundleAdding pe file C:UsersQDocumentsVisual Studio 2012ProjectsNetduinoBlinkingLedBlinkingLedbinDebugleBlinkingLed.pe to deployment bundleAdding pe file C:Program FilesSecret LabsNetduino SDKAssembliesv4.2lesecretlabs.netmf.hardware.netduinoplus.pe to deployment bundleAttempting deployment...Incrementally deploying assemblies to deviceAll assemblies on the device are up to date.  No assembly deployment was necessary.Assemblies successfully deployed to device.Restarting interpreter...Attaching to device...Waiting for device to initialize...

 

Anyone have any ideas about what is going wrong with my non blinking arduino?

 
Thanks
 




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.