public static void InitializePeripherals() { LedGreen.Write(true); Clock = new DS1307(); ThermoCouple = new Max6675(); InitializeStorage(true); InitializeClock(new DateTime(2012, 06, 06, 16, 22, 00)); ThermoCouple.Initialize(ThermoCoupleChipSelect); TemperatureSampler = new Timer(new TimerCallback(LogTemperature), null, 250, TemperatureLoggerPeriod); LedGreen.Write(false); }
public static void Main() { ComPort.Initialize(); ComPort.Messenger += new SerialMessengerHandler(OnMessage); ComPort.Send("Running.\r\n"); Temp.Initialize(GoSockets.Socket6); while (true) { ReadTemp(); Thread.Sleep(2); } }
public static void Main() { var thermocouple = new Max6675(); var relay = new Relay(); relay.Initialize(GoSockets.Socket8); thermocouple.Initialize(GoSockets.Socket7); while (true) { thermocouple.Read(); if (thermocouple.Celsius < 21) { relay.Activate(true); } else { relay.Activate(false); } Debug.Print("Temp C:" + Shorten(thermocouple.Celsius.ToString()) + " / F:" + Shorten(thermocouple.Farenheit.ToString())); Thread.Sleep(1000); } }
public void Render(VirtualCanvas canvas) { Relay.Initialize(RelaySocket); ThermoCouple.Initialize(ThermoCoupleSocket); canvas.SetOrientation(Orientation.Landscape); canvas.DrawFill(BackgroundColor); canvas.DrawString(55, 4, 0, VerdanaBold14.ID, "Temperature & Relay"); canvas.DrawString(32, 74, 0, VerdanaBold14.ID, "Celsius:"); canvas.DrawString(32, 116, 0, VerdanaBold14.ID, "Fahrenheit:"); canvas.DrawString(32, 154, 0, VerdanaBold14.ID, "Relay:"); canvas.DrawButton( 32, 197, 250, 36, VerdanaBold14.ID, 20, ColorHelpers.GetRGB24toRGB565(0, 0, 0), ColorHelpers.GetRGB24toRGB565(255, 255, 255), ColorHelpers.GetRGB24toRGB565(0, 0, 0), "Click To Exit", RoundedCornerStyle.All); canvas.Execute(); canvas.Touch += TouchEventHandler; while (LastTouchIsValid == 0) { ReadTemp(); Thread.Sleep(100); canvas.DrawRectangleFilled(93, 153, 158, 176, BackgroundColor); canvas.DrawRectangleFilled(105, 69, 175, 94, BackgroundColor); canvas.DrawRectangleFilled(138, 112, 205, 137, BackgroundColor); canvas.DrawString(32, 74, 0, VerdanaBold14.ID, "Celsius: " + Shorten(ThermoCouple.Celsius.ToString())); canvas.DrawString(32, 116, 0, VerdanaBold14.ID, "Fahrenheit: " + Shorten(ThermoCouple.Farenheit.ToString())); canvas.DrawString(32, 154, 0, VerdanaBold14.ID, "Relay: " + ((RelayStatus) ? "ON" : "OFF")); canvas.Execute(); canvas.TouchscreenWaitForEvent(TouchScreenEventMode.NonBlocking); } canvas.Touch -= TouchEventHandler; Relay.Dispose(); ThermoCouple.Dispose(); }