You must be logged in to reply.

Page 1 of 1 out of 4 messages.

Creation - SimpleTemperature

5 likes
Posted 4yr ago
by iamin | Hero | 17,993 exp
Posted 4yr ago
by iamin | Hero | 17,993 exp
I just posted SimpleTemperature on Creations. Feel free to discuss and make suggestions here.
Reply #1 — Posted 4yr ago
by dominik38 | Senior | 2,476 exp
Reply #1 — Posted 4yr ago
by dominik38 | Senior | 2,476 exp
nice one.. I like Smiley
3 likes
Reply #2 — Posted 4yr ago
by Duke Nukem | Legend | 67,053 exp
Reply #2 — Posted 4yr ago
by Duke Nukem | Legend | 67,053 exp
I ordered 2 of these with sockets and the $1.50 shipping and so for $15 I got 2 very nice temperature modules and gave them a quickie test as they have some very nice features

using System;
using Gadgeteer.Modules.GHIElectronics;
using Gadgeteer.Modules.StablePoint;
using Microsoft.SPOT;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;


namespace SimpleTempTest
{
    public partial class Program
    {
        private readonly GT.Timer _timer = new GT.Timer(60000);
 
        private void ProgramStarted()
        {
            Debug.Print("Program Started");

            simpleTemperature.AlertEvent += simpleTemperature_AlertEvent;

            simpleTemperature.SetHysteresis(SimpleTemperature.Hysteresis.OneAndHalf);
            simpleTemperature.SetResolution(SimpleTemperature.Resolution.OneSixteenthDegree);

            simpleTemperature.SetAlertLower(20);
            simpleTemperature.SetAlertUpper(25);

            //simpleTemperature.Disable();
            //simpleTemperature.Enable();

            led7C.SetColor(LED7C.Color.Green);

            simpleTemperature.EnableAlerts();

            _timer.Tick += _timer_Tick;
            _timer.Start();
        }

        private void _timer_Tick(GT.Timer timer)
        {
            var t1 = simpleTemperature.GetTemperature();

            characterDisplay.Clear();
            characterDisplay.Print(t1.ToString());
            characterDisplay.SetCursorPosition(1, 0);

            //simpleTemperature.EnableAlerts();
        }

        private void simpleTemperature_AlertEvent(SimpleTemperature sender, DateTime time)
        {
            var t = sender.GetTemperature();

            Debug.Print("Alert " + time + "  " + t);

            if (t > 22)
                led7C.SetColor(LED7C.Color.Red);
            else
            {
                led7C.SetColor(LED7C.Color.Blue);
            }

            //simpleTemperature.DisableAlerts();
        }
    }
}
1 like
Reply #3 — Posted 4yr ago
by devhammer | Legend | 55,820 exp
Reply #3 — Posted 4yr ago
by devhammer | Legend | 55,820 exp
@Duke Nukem - Love the fact that it surfaces alerts as a configurable event...that's very handy, and a great example of the kinds of abstractions that make me love Gadgeteer.

Nice job on the driver @iamin!

Page 1 of 1 out of 4 messages.

You must be logged in to reply.