- Netduino Forums
- → Kem's Content
Kem's Content
There have been 17 items by Kem (Search limited from 25-September 23)
#36676 WebRequest takes a long time
Posted by Kem on 07 October 2012 - 10:31 AM in Netduino Plus 2 (and Netduino Plus 1)
#36672 WebRequest takes a long time
Posted by Kem on 07 October 2012 - 10:17 AM in Netduino Plus 2 (and Netduino Plus 1)
socket.Connect(new IPEndPoint(IPAddress.Parse("192.168.2.231"), 80));
O, don't forget to import the following namespace, cause the IPEndPoint and IPAddress live there
using System.Net;
Cheers,
Kem
#35377 Trigger a function based on time of day
Posted by Kem on 16 September 2012 - 01:49 PM in Netduino Plus 2 (and Netduino Plus 1)
using System; using Microsoft.SPOT; using System.Threading; namespace DoThingAtEleven { public class Program { public static void Main() { Debug.Print(DateTime.Now.ToString("HH:mm:ss")); DateTime needEventAt = DateTime.Today + new TimeSpan(23, 00, 0); long ticksToEleven = needEventAt.Ticks - DateTime.Now.Ticks; int millisecondsToEleven = (int)(ticksToEleven / TimeSpan.TicksPerMillisecond); Timer triggerAtEleven = new Timer(new TimerCallback(DoThingAtEleven), null, millisecondsToEleven, Timeout.Infinite); Thread.Sleep(Timeout.Infinite); } private static void DoThingAtEleven(object state) { Debug.Print("It's time!"); Debug.Print(DateTime.Now.ToString("HH:mm:ss"); } } }
#48858 reading data through a serial port on netduino plus 2
Posted by Kem on 29 April 2013 - 08:31 PM in Netduino Plus 2 (and Netduino Plus 1)
Like NooM said on the Thread.Sleep(Timeout.Infinite);, but as far as I know you also have to read the data from the serial buffer, otherwise you will not receive new data.
You could also change the sleep of 1000 ms to a timer that will turn off the led after 1 second. This way you do not have to pause the thread.
#35585 Problem using AnalogInput
Posted by Kem on 20 September 2012 - 11:50 AM in Netduino Plus 2 (and Netduino Plus 1)
Make sure you have added references to Microsoft.Spot.Hardware and SecretLabs.NETMF.Hardware.NetduinoPlus.
This code works just fine for me:
Option Explicit On Option Strict On Imports Microsoft.SPOT Imports Microsoft.SPOT.Hardware Imports SecretLabs.NETMF.Hardware.NetduinoPlus Namespace VBMicroTest Public Module Module1 Sub Main() Dim potMeter As New AnalogInput(AnalogChannels.ANALOG_PIN_A0) Debug.Print("Value: " + potMeter.Read().ToString()) End Sub End Module End Namespace
Regards,
Kem
#35553 Problem using AnalogInput
Posted by Kem on 19 September 2012 - 09:30 PM in Netduino Plus 2 (and Netduino Plus 1)
When using the AnalogInput from Microsoft.Spot.Hardware you have to use a Cpu.AnalogChannel, not a Cpu.Pin.
So to map to the Analog Pins of your Netduino you use SecretLabs.NETMF.Hardware.NetduinoPlus.AnalogChannels.ANALOG_PIN_A0.
Imports Microsoft.SPOT.Hardware Imports SecretLabs.NETMF.Hardware.NetduinoPlus Dim potMeter As New AnalogInput(AnalogChannels.ANALOG_PIN_A0)
I just typed the code in here, so forgive me if I made typos .
Regards,
Kem
#35631 Problem using AnalogInput
Posted by Kem on 20 September 2012 - 07:10 PM in Netduino Plus 2 (and Netduino Plus 1)
believe me, I'm trying my best to help you . I'll try to explain in detail how it should work.
There are two AnalogIn classes, one of Microsoft (Microsoft.SPOT.Hardware.AnalogInput) and one of SecretLabs (SecretLabs.NETMF.Hardware.AnalogInput). In the last code you gave, you import both of these namespaces, you now can not use AnalogIn without specifying it's full name. Otherwise the compiler does not know which class to use (ambiguous).
I am using the one supplied by Microsoft, for this you only need references to the following:
Microsoft.SPOT.Hardware (4.2.0.0)
Microsoft.SPOT.Native (4.2.0.0)
mscrorlib (4.2.0.0)
SecretLabs.NETMF.Hardware.NetduinoPlus ((4.2.0.1)
I made a small program with nothing more than the code as shown below. Just to make sure that there are no conflicts in imports, I used the full names of the classes:
AanalogIn > Microsoft.SPOT.Hardware.AnalogInput
ANALOG_PIN_A0 > SecretLabs.NETMF.Hardware.NetduinoPlus.AnalogChannels.ANALOG_PIN_A0
The AnalogIn class contains the functionality of sampling an analog input. But Microsoft does not know anything about the Netduino Plus. Therefor SecretLabs made a nice little class to map the Netduino's PINs to the ones expected by the AnalogIn class.
The code:
Option Explicit On Option Strict On Imports Microsoft.SPOT Namespace MFConsoleApplication1 Public Module Module1 Sub Main() Dim potMeter As New Microsoft.SPOT.Hardware.AnalogInput(SecretLabs.NETMF.Hardware.NetduinoPlus.AnalogChannels.ANALOG_PIN_A0) For i As Integer = 1 To 50 Debug.Print("Value: " & potMeter.Read().ToString()) Next End Sub End Module End Namespace
A few lines of the debug output:
Value: 0.0019550342130987292
Value: 0.015640273704789834
Value: 0.016617790811339198
Value: 0.00097751710654936461
Value: 0.0019550342130987292
Value: 0.01466275659824047
Value: 0.016617790811339198
O one last thing I can think of, do you have firmware 4.2 on your Netduino? The one's I just bought arrived with firmware 4.1 on it.
Hope this helps!
Regards,
Kem
OK, scratch that about the firmware, you've said that already in your first post
#35612 Problem using AnalogInput
Posted by Kem on 20 September 2012 - 05:25 PM in Netduino Plus 2 (and Netduino Plus 1)
#48855 Netduino serial data eventhandler
Posted by Kem on 29 April 2013 - 08:17 PM in Netduino 2 (and Netduino 1)
Hi,
I've had the same problem a while ago, turns out you need to add a reference to Microsoft.SPOT.Hardware.dll. The SerialDataReceivedEventHandler seems to live there .
Cheers,
Kem
#48856 Netduino serial data eventhandler
Posted by Kem on 29 April 2013 - 08:19 PM in Netduino 2 (and Netduino 1)
O and it might be a good idea to change the parameters of your serialPort_DataReceived method
void serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
#34963 Looking for a simple TCP -> Serial Example
Posted by Kem on 10 September 2012 - 03:10 PM in Netduino Plus 2 (and Netduino Plus 1)
Attached Files
- TelnetSerialPassthrough.zip 14.35KB 107 downloads
#36675 Looking for a simple TCP -> Serial Example
Posted by Kem on 07 October 2012 - 10:28 AM in Netduino Plus 2 (and Netduino Plus 1)
Dear Kem,
May I see you schematic? Are just using TCP/ip port. I'm sorry, I just newbie on netduino
Hi Fahdil,
Don't be sorry for being a newbie, there's only one way to get rid of that, and that's playing around with the Netduino and asking for help from time to time
I've just plugged in an ethernet cable into my Netduino Plus, and connected something that talks serial to one of the two UARTS on the Netduino.
UART1 (pins 0 RX and 1 TX)
UART2 (pins 2 RX and 3 TX)
http://www.netduino....oplus/specs.htm
#48686 Arduino GSM Shield (integrated antenna) (A000043)
Posted by Kem on 24 April 2013 - 10:24 AM in Visual Basic Support
Hi,
I've just started to play with the same GSM shield (http://arduino.cc/en...rduinoGSMShield). So far I have been able to send and read SMS messages.
The newest version of the Quectel M10 AT Commands documentation I could find: http://www.sigmaelec...10_ATC_V1.2.pdf
Cheers,
Kem
#49019 Arduino GSM Shield (integrated antenna) (A000043)
Posted by Kem on 04 May 2013 - 08:39 AM in Visual Basic Support
I have modified my telnet - serial passthrough program a bit, so it works with the Arduino GSM Shield. This way you can test the AT commands of the shield.
SIM Ready:
AT+CPIN?
Signal strength:
AT+CSQ
Send SMS:
AT+CMGF=1AT+CSCS="8859-1"AT+CMGS="<number>"<message><CTRL-Z>
Have fun!
Attached Files
- SerialPassThrough.zip 17.97KB 26 downloads
#36683 Adafruit 20x2 Character VFD (Vacuum Fluorescent Display) - SPI interface - 20...
Posted by Kem on 07 October 2012 - 01:37 PM in General Discussion
Writing the complete display for 1000 times took 00:03:37.444 and now takes 00:00:37.705, makes for a difference of just 3 minutes .
The things I changed:
private void command(byte value) { _latchPort.Write(false); _spi.Write(new byte[] { VFD_SPICOMMAND, value, VFD_SPICOMMAND, value }); _latchPort.Write(true); }
private void write(byte value) { _latchPort.Write(false); _spi.Write(new byte[] { VFD_SPIDATA, value, VFD_SPIDATA, value }); _latchPort.Write(true); }
If you change the print method you can even knock off another 5 seconds to: 00:00:32.094.
public void print(string data) { byte[] output = System.Text.Encoding.UTF8.GetBytes(data); byte[] buffer = new byte[] { VFD_SPIDATA, 0, VFD_SPIDATA, 0 }; for (int i = 0; i < output.Length; i++) { _latchPort.Write(false); buffer[3] = output[i]; _spi.Write(buffer); _latchPort.Write(true); } }
#35554 Adafruit 20x2 Character VFD (Vacuum Fluorescent Display) - SPI interface - 20...
Posted by Kem on 19 September 2012 - 09:36 PM in General Discussion
#36677 Adafruit 20x2 Character VFD (Vacuum Fluorescent Display) - SPI interface - 20...
Posted by Kem on 07 October 2012 - 10:56 AM in General Discussion
So, browse the internet, quickly find out how to connect it, and see if it works. It is a really nice screen I must say.
I can confirm that I have exactly the same issue you do, but that's not really strange, because I've loaded your code . As soon as I remove the second write action from the write method things go wrong. The first byte you send gets ignored, the second one works.
private void write(byte value) { _latchPort.Write(false); _writeBuf[0] = VFD_SPIDATA; _spi.Write(_writeBuf); _writeBuf[0] = value; _spi.Write(_writeBuf); _latchPort.Write(true); Thread.Sleep(1); _latchPort.Write(false); _writeBuf[0] = VFD_SPIDATA; _spi.Write(_writeBuf); _writeBuf[0] = value; _spi.Write(_writeBuf); _latchPort.Write(true); Thread.Sleep(1); }
Now to find out why...
- Netduino Forums
- → Kem's Content
- Privacy Policy