using System;
using System.Text;
using System.Threading;
using System.IO.Ports;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.FEZ;
//using GHIElectronics.NETMF.Hardware;
namespace FEZ_Domino_Application1
{
public class Program
{
public static void Main()
{
// Blink board LED
bool ledState = false;
///////////////////////////////////////////////////////////////////////////////
//Setup buffer for DSP calculations
//int[] Reg_Buffer;
//Reg_Buffer = new int[2500];
//AnalogIn BatteryVoltage = new AnalogIn((AnalogIn.Pin)FEZ_Pin.AnalogIn.An0);
//BatteryVoltage.SetLinearScale(0, 3300);
//for (int i = 0; i < 2499; i++)
//{
// int voltage = BatteryVoltage.Read();
// //sleep for 3 ms
// Thread.Sleep(3);
// Reg_Buffer[i] = (voltage / 1000);
//}
//////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
//Setting up analog out
//AnalogOut VoltLevel =
//new AnalogOut((AnalogOut.Pin)FEZ_Pin.AnalogOut.An3);
//VoltLevel.SetLinearScale(0, 3300);
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//difference(ref Reg_Buffer);
//square(ref Reg_Buffer);
//integral(ref Reg_Buffer);
//display(ref Reg_Buffer, ref VoltLevel);
////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);
// create serial port for bluetooth . Connect BLUETOOTH_RX to Di8 and BLUETOOTH_TX to Di7.
SerialPort bluetooth = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
bluetooth.Open();
while (true)
{
// create heart rate information bytes
byte[] helloBytes = Encoding.UTF8.GetBytes("125");
bluetooth.Write(helloBytes, 0, helloBytes.Length);
//////////////////////////////////////////////////////////////////////////////////////////////////
// VoltLevel.Set(1000);
//// toggle LED state
ledState = !ledState;
led.Write(ledState);
//sleep for 3 ms
Thread.Sleep(300);
}
}
}
}
okay so anytime I add the " GHIElectronics.NETMF.Hardware" reference, My board doesn't respond, that's why i have it commented out at the top. the problem is that i need that reference in order to access the analog in and out. please how do i fix this?
Please tag your code so it is easy to read. I modified your post.
Update your firmware and your project to the latest firmware. If still having problems, make new project and try again.
Have you added the reference in your project to GHIElectronics.NETMF.Hardware
(and please use the code tag in your post, it’s the button with “010101”)
how do i find the firmware. i couldn’t find it in the folder the you tube video specified.
okay so i updated the device and i still have that problem. I can’t access the analog in and outs. once i add the “GHIElectronics.NETMF.Hardware” to the reference list, it starts messing up.
Maybe this http://www.tinyclr.com/forum/1/1562/
If I try to Add a reference to GHIElectronics.NETMF.Hardware.dll I get
GHIElectronics.NETMF.Hardware, Version=4.1.5.0, Culture=neutral, PublicToken=null" is incompatible with .NET MicroFramework 4.1.2821.0
not exactly sure what is going on with this… But maybe an example .csproj showing the exact reference would help…
First deploy a program that does not use GHI libraries, does it work?
Then try our examples. If you are having problems, they are because the firmware on the device is not up o date or you have an old installed SDK as Gus said earlier in the thread.
Sounds like Power Tools again!!
Cheers Ian
Or you have VS2010 Power tools installed.
Hehe, IanR beat me…