- Netduino Forums
- → CarTech's Content
CarTech's Content
There have been 9 items by CarTech (Search limited from 26-April 23)
#27246 SD Card Issues.
Posted by CarTech on 14 April 2012 - 03:41 PM in Netduino 2 (and Netduino 1)
#25161 Native code lighter on memory?
Posted by CarTech on 06 March 2012 - 10:00 PM in Netduino 2 (and Netduino 1)
#21114 Reference for System.Uri?
Posted by CarTech on 29 November 2011 - 05:19 PM in Netduino Plus 2 (and Netduino Plus 1)
#21113 Reference for System.Uri?
Posted by CarTech on 29 November 2011 - 05:00 PM in Netduino Plus 2 (and Netduino Plus 1)
Hello.
Don’t think that system.Uri exist in Micro .net framework.
http://msdn.microsof...y/cc533014.aspx
I have 4.1, which shows it in the API reference:
http://msdn.microsof...y/ee436970.aspx
Any other ideas?
#21111 Reference for System.Uri?
Posted by CarTech on 29 November 2011 - 04:40 PM in Netduino Plus 2 (and Netduino Plus 1)
using System; 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.NetduinoPlus; namespace TestingUri { public class Program { public static void Main() { // write your code here Uri myUri = new Uri("http:\\www.google.com"); } } }
#19767 Timer only executes five times?
Posted by CarTech on 25 October 2011 - 07:08 PM in Netduino Plus 2 (and Netduino Plus 1)
For reference, I declared the timer as a field in the class (instead of local variable) and it works perfectly. Here's the updated code:
EDIT: fixed error in code copy paste
using System; using System.IO; 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.NetduinoPlus; namespace Testing9DOF { public class BufferFileManager { // Declare timer private static Timer timer; // Constructor public BufferFileManager() { Debug.Print("Created a new BufferFileMananger instance"); } // Public methods public void StartDAQ() { // Start up sensor class ADXL345 myAccel = new ADXL345(); myAccel.CheckConnection(); myAccel.FullResolution = true; myAccel.EnableMeasurements(); myAccel.SetDataRate(0x08); // Start collecting data to file timer = new Timer(delegate(object o) { myAccel.ReadAllAxes(); string data = myAccel.ScaledXAxisG + "\t" + myAccel.ScaledYAxisG + "\t" + myAccel.ScaledZAxisG; Debug.Print(data); }, null, 0, 80); } } public class Program { public static void Main() { BufferFileManager fm = new BufferFileManager(); fm.StartDAQ(); Thread.Sleep(Timeout.Infinite); } } }
#19730 Timer only executes five times?
Posted by CarTech on 25 October 2011 - 02:14 AM in Netduino Plus 2 (and Netduino Plus 1)
I'm using an ADXL345 accelerometer connected to the netduino via I2C. I've attached the class for the accelerometer which I got almost directly from LoveElectronics ADXL345 Library & Tutorial. This code works very nicely.
Unfortunately the sensor stick from SparkFun, which I have, doesn't have the interrupts on the ADXL345 broken out. Thus, I've resorted to polling the ADXL345 with a timer.
The problem I'm having is that the timer only executes five times. If I change the time interval (tried 8ms and 800ms), it still only runs five times. Here's the problematic code:
using System; using System.IO; 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.NetduinoPlus; namespace Testing9DOF { public class BufferFileManager { // Constructor public BufferFileManager() { Debug.Print("Created a new BufferFileMananger instance"); } // Public methods public void StartDAQ() { // Start up sensor class ADXL345 myAccel = new ADXL345(); myAccel.CheckConnection(); myAccel.FullResolution = true; myAccel.EnableMeasurements(); myAccel.SetDataRate(0x08); // Start collecting data to file Timer timer = new Timer(delegate(object o) { myAccel.ReadAllAxes(); string data = myAccel.ScaledXAxisG + "\t" + myAccel.ScaledYAxisG + "\t" + myAccel.ScaledZAxisG; Debug.Print(data); }, null, 0, 80); } } public class Program { public static void Main() { BufferFileManager fm = new BufferFileManager(); fm.StartDAQ(); Thread.Sleep(Timeout.Infinite); } } }
Now, if put everything in the Main class, it works fine:
using System; using System.IO; 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.NetduinoPlus; namespace Testing9DOF { public class Program { public static void Main() { ADXL345 myAccel = new ADXL345(); myAccel.CheckConnection(); myAccel.FullResolution = true; myAccel.EnableMeasurements(); myAccel.SetDataRate(0x08); // Start collecting data to file Timer timer = new Timer(delegate(object o) { myAccel.ReadAllAxes(); string data = myAccel.ScaledXAxisG + "\t" + myAccel.ScaledYAxisG + "\t" + myAccel.ScaledZAxisG; Debug.Print(data); }, null, 0, 80); Thread.Sleep(Timeout.Infinite); } } }
Not really sure what's going on. I'm guessing it's something to do with how I've attempted to put it in a second class? Any ideas?
Attached Files
- adxl345.cs 9.35KB 3 downloads
#19138 Netduino - WiFi
Posted by CarTech on 14 October 2011 - 01:16 AM in Project Showcase
Hi, unfortunately I have not used the built-in http features of the Gainspan. For my Gainspan projects I rolled my own http communications.
I figured out the problem was I left out the command which sets the data length, fifth line below. Here is the working code snippet:
at+httpconf=20,Mozilla/4.0\r at+httpconf=3,keep-alive\r at+httpconf=11,enginuitydiagnostics.com\r at+httpconf=7,application/x-www-form-urlencoded\r at+httpconf=5,23\r at+httpopen=<myhostip>\r at+httpsend=0,3,10,/test_post.php,23\r\x1BHname=myName&info=myInfo
#18672 Netduino - WiFi
Posted by CarTech on 02 October 2011 - 05:16 PM in Project Showcase
at+httpconf=20,User-Agent: Mozilla/4.0\r at+httpconf=3,keep-alive\r at+httpconf=11,<myhost>\r at+httpconf=7,application/x-www-form-urlencoded\r at+httpopen=<myhostip>\r at+httpsend=0,3,10,/test_post.php,23\r\x1BHname=myName&info=myInfo
Any suggestions? I'm not sure what to try next.
- Netduino Forums
- → CarTech's Content
- Privacy Policy