I tried running the TempSensor example snippet, and I am not seeing any temp readings. I think the problem is with the debug.print command, you have to be in the emulator mode? But, if I change the program property to emulator, then it does not find the Panda. I tried a Console.Writeline, but that is not a valid command. What am I missing now?
I made a simple program with a debug.print statement, not expected results. It puts up a weird looking sample.emulator screen, but it does not display my debug.print statement.
OK, this is probably a stupid question, but where is the output window? I am using VS 2010 C# express, and I am not seeing any window opening up when I ‘Start Debugging’. I have always used ‘Start Debugging’ to run a program, am I supposed to use something else?
Learn something new every day, the output window. I enabled it, and when I run the program below, it shows “Device not detected”. I have all the connections plugged in correctly, and in the right spots, but no go. So, is this a bad e_block?
[CODE]
using System;
using Microsoft.SPOT;
using System.Threading;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.Hardware;
using GHIElectronics.NETMF.FEZ;
namespace TempSensor
{
public class Program
{
public static void Main()
{
// Change this to your correct pin!
Cpu.Pin myPin = (Cpu.Pin)FEZ_Pin.Digital.An2;
OneWire ow = new OneWire(myPin);
ushort temperature;
// read every second
while (true)
{
if (ow.Reset())
{
ow.WriteByte(0xCC); // Skip ROM, we only have one device
ow.WriteByte(0x44); // Start temperature conversion
while (ow.ReadByte() == 0) ; // wait while busy
ow.Reset();
ow.WriteByte(0xCC); // skip ROM
ow.WriteByte(0xBE); // Read Scratchpad
temperature = ow.ReadByte(); // LSB
temperature |= (ushort)(ow.ReadByte() << 8); // MSB
Debug.Print("Temperature: " + temperature / 16);
Thread.Sleep(1000);
}
else
{
Debug.Print("Device is not detected.");
}
Thread.Sleep(1000);
}
}
}
Oh! you are not seeing them because you are even running the program I do not think. Start here and make sure you can load your applications nicely Home - GHI Electronics
No, the emulator window does not pop up. I do see, at the bottom of the window where it shows that the device is rebooting, and ready. Then it starts with the “Device not detected.” Well, at this point I know I have a good button, and LEDs.
[quote]I just did the ping thing, and it showed a “Pinging… TinyCLR”. I tried all of the sockets with no success.
Hmm, I wonder what is going on.[/quote]
No Gus, he is facing a problem with the temperature e-block and no the Panda. The “device not found” is being printed from the else part of the code. He is modifying the code from the documentation.
Can some one who has the eblock, Panda II and Connect, test the code for repro ?
Yes, I want to verify that I get a “Pinging… TinyCLR”, but I also get a “Device not found” when I run the program. And I did mention that I tried all of the sockets, I remembered to change the code for each socket tested.
I don’t have an e-block, but i have a pair of DS18B20s on wires that i can test that code with. It seems to work fine for me, at least basically. I only get integers for temp readings (i had this issue before; its annoying and i don’t know why it was fixed really… When i didn’t get a device found it always ended up being that i had forgotten something physically, like grounding it or the power resistor was out etc…
Try this, if you finally do get the device found:
using System;
using Microsoft.SPOT;
using System.Threading;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.Hardware;
using GHIElectronics.NETMF.FEZ;
namespace TempSensor
{
public class Program
{
public static void Main()
{
// Change this to your correct pin!
Cpu.Pin myPin = (Cpu.Pin)FEZ_Pin.Digital.Di6;
OneWire ow = new OneWire(myPin);
ushort temp;
double last = 0;
double tempc = 1; // temperature in degrees Celsius
while (true)
{
if (ow.Reset())
{
ow.WriteByte(0xCC);
ow.WriteByte(0x44); // Start temperature conversion
while (ow.ReadByte() == 0)
{
ow.Reset();
ow.WriteByte(0xCC);
ow.WriteByte(0xBE); // Read Scratchpad
temp = ow.ReadByte(); // LSB
temp |= (ushort)(ow.ReadByte() << 8); // MSB
tempc = (temp * .0625);
if (tempc != last)
{
Debug.Print("Temp: " + tempc.ToString("F4") + "C");
last = tempc;
}
}
}
else
{
Debug.Print("Device is not detected.");
}
Thread.Sleep(1000);
}
}
}
}