示例#1
0
        public static void Main()
        {
            _appVersion = typeof(Program).Assembly.GetName().Version;

            DisplayTitlePage();

            ClearStatus();
            BrainPad.Display.DrawFillRect(65, 100, 10, 10, BrainPad.Color.Palette.Black);

            ICommunicationChannel channel = null;

            _firmata = new FirmataService("BrainPad", "b335f01176044984941833c9ce00d3ae", _appVersion.Major, _appVersion.Minor);
            _board = new BrainPadBoard(_firmata);

            try
            {
                var vsp = new Cdc();
                Controller.ActiveDevice = vsp;
                channel = new UsbCommunicationChannel(vsp);
                DisplayStatus("Using USB. Reset to deploy");
            }
            catch
            {
                var port = new SerialPort("COM1", 115200, Parity.None, 8, StopBits.One);
                channel = new SerialCommunicationChannel(port);
                DisplayStatus("Using secondary serial port");
            }

            _firmata.Open(_board, channel);

            while (true)
            {
                _board.Process();
            }
        }
示例#2
0
 // This method is run when the mainboard is powered up or reset.
 void ProgramStarted()
 {
     //TODO: Read config values to find out if we have a USB serial adapter and on which port? do we have a serial-capable Bee? Do we have an ethernet port?
     //  Construct the comms channels on that basis.  For now, its hardcoded for serial usb on port 1, and with ethernet
     //TODO: Set name based on a config value
     _firmata = new FirmataService("GHICerbuino", "", 1, 0);
     _board = new CerbuinoBoard(_firmata, Mainboard);
     _firmata.Open(_board, new UsbSerialCommunicationChannel(usbSerial) /*, new EthernetCommunicationChannel()*/);
 }
示例#3
0
 public CerbuinoBoard(FirmataService firmata, Mainboard mb)
 {
     _firmata = firmata;
     _mb = mb;
 }