コード例 #1
0
        public LCDTest()
        {
            // RS,RW,E,D4,D5,D6,D7
            RaspPiGPIOMemLcdTransferProvider lcdProvider = new RaspPiGPIOMemLcdTransferProvider(
                GPIOPins.Pin_P1_07,
                GPIOPins.Pin_P1_22,
                GPIOPins.Pin_P1_11,
                GPIOPins.Pin_P1_12,
                GPIOPins.Pin_P1_15,
                GPIOPins.Pin_P1_16,
                GPIOPins.Pin_P1_18);

            string meintext = "Hello World, how are you?";
            Lcd    lcd      = new Lcd(lcdProvider);

            lcd.Begin(16, 2);
            lcd.Clear();
            lcd.Backlight = false;
            lcd.SetCursorPosition(0, 0);
            lcd.Write(meintext);
            //System.Threading.Thread.Sleep (3);
            //lcd.Clear();
            //lcd.Write("Ahoj Bernie?!");
            System.Threading.Thread.Sleep(2000);
            int anzahl = meintext.Length;

            while (anzahl > 0)
            {
                lcd.ScrollDisplayLeft();
                System.Threading.Thread.Sleep(200);
                anzahl--;
            }
        }
コード例 #2
0
        public static void Main()
        {
            var bus = new I2CBus();

            var lcdProvider = new MCP23008LcdTransferProvider(bus);
            var lcd         = new Lcd(lcdProvider);

            lcd.Begin(16, 2);
            lcd.Backlight = true;
            lcd.Write("Payload McPayload Face v1.0");
            for (int i = 0; i < 12; i++)
            {
                lcd.ScrollDisplayLeft();
                Thread.Sleep(200);
            }
            Thread.Sleep(1000);
            lcd.Clear();
            LCDFinish(lcd, "ACC DemoSat 2016");

            //THIS SECTION CREATES / INITIALIZES THE SERIAL LOGGER
            Debug.Print("Flight computer started successfully. Beginning INIT.");

            //Lcd = new LiquidCrystalI2C(0x01, 16, 2);
            //Lcd.write("Testing!");
            lcd.Write("Starting logger.");
            var logger = new Logger();

            Debug.Print("Starting logger.");
            logger.Start();
            LCDFinish(lcd, "Done.");


            lcd.Write("Starting clock...");
            Rebug.Print("Starting clock.");
            Clock.Instance.Start();
            LCDFinish(lcd, "Done.");

            //THIS SECTION CREATES/INITIALIZES THE PRESSURE SENSOR
            //lcd.Write("Init BMP sensor.");
            //Rebug.Print("Initializing BMP Sensor ");
            //var bmploop = new PressureTempAltitudeUpdater(bus, delay: 1000);
            //LCDFinish(lcd);

            //THIS SECTION CREATES/INITIALIZES THE SERIAL BNO 100HZ UPDATER
            lcd.Write("Init BNO sensor...");
            Rebug.Print("Initializing BNO Sensor ");
            var bno     = new SerialBno(SerialPorts.COM1, 5000, 5000, SerialBno.Bno055OpMode.OperationModeNdof);
            var bnoloop = new SerialBnoUpdater(bno, delay: 1000);

            LCDFinish(lcd, "Done.");

            ////Starts up the expensive mag
            lcd.Write("Init exp. mag...");
            Rebug.Print("Initializing expensive magnetometer on com3");
            var expensiveMagLoop = new ExpensiveMagUpdater(delay: 1000);

            LCDFinish(lcd, "Done.");

            lcd.Write("Init calib disp.");
            Rebug.Print("Initializing BNO calibration display loop");
            var printBnoCalib = new BNOCalibUpdate(bno, lcd, delay: 1000);

            LCDFinish(lcd, "Done.");

            //////THIS SECTION CREATES/INITIALIZES THE MAGNETOMETER UPDATER
            var mag_dump_size = 18432;

            lcd.Write("Init fast mag...");
            Rebug.Print("Initializing fast mag dump collector with a size of " + mag_dump_size + "bytes.");
            var customMagLoop = new CustomMagUpdater(mag_dump_size, AnalogChannels.ANALOG_PIN_A0);

            LCDFinish(lcd, "Done.");

            //Thread.Sleep(5000);
            lcd.Write("Init complete...");
            Rebug.Print("Flight computer INIT Complete. Continuing with boot.");
            LCDFinish(lcd, "Continuing boot.");

            //THIS SECTION INITIALIZES AND STARTS THE MEMORY MONITOR
            lcd.Write("Start memory monitor...");
            Rebug.Print("Starting memory monitor...");
            MemoryMonitor.Instance.Start(ref logger);
            LCDFinish(lcd, "Done.");

            ////THIS STARTS THE Mag dump update
            lcd.Write("Start f.mag loop...");
            Rebug.Print("Starting fast mag dump...");
            customMagLoop.Start();
            LCDFinish(lcd, "Done.");

            ////THIS STARTS THE BNO SENSOR UPDATE
            lcd.Write("Start bno loop...");
            Rebug.Print("Starting bno sensor updates...");
            bnoloop.Start();
            LCDFinish(lcd, "Done.");

            //THIS STARTS THE BNO SENSOR UPDATE
            //lcd.Write("Start bmp loop");
            //Rebug.Print("Starting bmp sensor updates...");
            //bmploop.Start();
            //LCDFinish(lcd);

            //THIS STARTS THE EXPENSIVE MAG UPDATE
            lcd.Write("Start e.mag loop...");
            Rebug.Print("Starting expensive mag updates...");
            expensiveMagLoop.Start();
            LCDFinish(lcd, "Done.");

            lcd.Write("Boot successful!");
            LCDFinish(lcd, "Entering run state.");

            Rebug.Print("Flight computer boot successful.");
            printBnoCalib.Start();
        }
コード例 #3
0
        public static void Main()
        {
            serialPort.ReadTimeout = 0;

            string InitMessage = "Initializing...";

            // set up the LCD's number of columns and rows:
            lcd.Begin(columns: 16, lines: 2);
            lcd.Backlight = true;
            lcd.Clear();
            lcd.Clear();
            lcd.SetCursorPosition(0, 0);

            // Print a message to the LCD.
            lcd.Write(" *** ARMING ***");
            Thread.Sleep(250);

            lcd.SetCursorPosition(column: 0, row: 1);
            lcd.Write("HomeAlarmPlus Pi");
            Thread.Sleep(1600);
            lcd.Clear();
            lcd.SetCursorPosition(column: 0, row: 0);
            lcd.Write(InitMessage);
            Thread.Sleep(1600);

            for (int i = 0; i < InitMessage.Length; i++)
            {
                lcd.ScrollDisplayLeft();
                Thread.Sleep(85);
            }

            lcd.Clear();
            lcd.SetCursorPosition(column: 0, row: 0);
            lcd.Write("HomeAlarmPlus Pi");

            MonitorZonesDelegate monitorZones = new MonitorZonesDelegate(MonitorZones);

            MonitorMotionSensorDelegate monitorMotion = new MonitorMotionSensorDelegate(MonitorSensors);

            SdCardEventLogger.parseConfigFileContents(Alarm.User_Definitions.Constants.ALARM_CONFIG_FILE_PATH);
            syncHttpEvents = Stopwatch.StartNew();

            InitArrays();
            IPAddress = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress;
            Console.DEBUG_ACTIVITY(IPAddress);
            lcd.SetCursorPosition(column: 0, row: 1);
            lcd.Write("IP: " + IPAddress + "       ");

            Thread.Sleep(1000);
            SdCardEventLogger.SDCardAccess();

            lcd.SetCursorPosition(column: 0, row: 1);
            lcd.Write("Port: " + Alarm.ConfigDefault.Data.Http_port + "        ");
            Thread.Sleep(1000);

            new Thread(Alarm.WebServer.startHttp).Start();

            //Time from Raspberry Pi
            Debug.Print("Setting Date and Time from Network");
            lcd.SetCursorPosition(column: 0, row: 1);
            lcd.Write("Finding RPi-srvr");
            Notification.PushingBox.Connect("vPUSHINGBOX");

            //Let's notify Pushover
            //With extension.replace spaces are replaced with %20 so that is recognized by PHP when posting parameters.
            string time  = DateTime.Now.ToString();
            string ttime = Extension.Replace(time, " ", "%20");

            Notification.Pushover.Connect(ttime, Extension.Replace("Netduino Plus Time set", " ", "%20"), Extension.Replace("Time set from Raspberry Pi", " ", "%20"), false);

            LastResetCycle  = DateTime.Now.ToString("ddd, d MMM yyyy hh:mm:ss tt\r\n");
            dLastResetCycle = DateTime.Now;
            Thread.Sleep(2000);

            lcd.SetCursorPosition(column: 0, row: 0);
            lcd.Write("Syncing data           ");
            lcd.SetCursorPosition(column: 0, row: 1);
            lcd.Write("Wunderground       ");
            parseWeatherData(ttime);
            Thread.Sleep(2000);

            lcd.Clear();
            lcd.SetCursorPosition(column: 0, row: 0);
            lcd.Write("HomeAlarmPlus Pi");
            lcd.SetCursorPosition(column: 0, row: 1);
            lcd.Write("Temp: " + Alarm.Common.Weather_Info.current_temperature + "      ");
            Thread.Sleep(2000);

            lcd.SetCursorPosition(column: 0, row: 1);
            lcd.Write("SYSTEM READY           ");
            Debug.Print("ARMED!");
            Thread.Sleep(560);
            ATTINYx5.Write(true);

            lcd.Clear();

            int count = 0, sub_count = 0;

            while (true)
            {
                Console.DEBUG_ACTIVITY("Main Method - Memory available: " + Debug.GC(true));
                monitorZones();
                //monitorMotion();

                lcd.Clear();
                if (count % 2 == 0)
                {
                    lcd.SetCursorPosition(column: 0, row: 0);
                    lcd.Write("  Date    Time");
                    lcd.SetCursorPosition(column: 0, row: 1);
                    lcd.Write(DateTime.Now.ToString("MMM dd/yy h:mmtt ").ToUpper());
                }
                else
                {
                    lcd.SetCursorPosition(column: 0, row: 0);
                    lcd.Write("  Current Temp");

                    lcd.SetCursorPosition(column: 0, row: 1);

                    if (sub_count % 2 == 0)
                    {
                        lcd.Write(Alarm.Common.Weather_Info.current_temperature + " " + Alarm.Common.Weather_Info.current_conditions);
                    }
                    else
                    {
                        lcd.Write("Hi: " + Alarm.Common.Weather_Info.today_high + " Lo: " + Alarm.Common.Weather_Info.today_low);
                    }

                    sub_count++;
                }

                Thread.Sleep(Alarm.Common.Alarm_Constants.ALARM_DELAY_TIME);

                double eHours = syncHttpEvents.ElapsedHours;
                if (eHours >= Alarm.ConfigDefault.Data.WUNDERGROUND_SYNC_FREQUENCY)
                {
                    parseWeatherData(Extension.Replace(DateTime.Now.ToString(), " ", "%20"));
                    syncHttpEvents = Stopwatch.StartNew();
                }

                count++;
            }
        }