using System.Collections.Generic;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows.Forms;
using MadeInTheUSB.Adafruit;
using MadeInTheUSB.Component;
using MadeInTheUSB.WinUtil;
using MadeInTheUSB.Display;
namespace MadeInTheUSB.ManagedDesktop
public partial class Form1 : Form
private void SetMessage(string m)
private void Form1_Load(object sender, EventArgs e)
this.Left = Screen.PrimaryScreen.WorkingArea.Width - this.Width;
this.Top = Screen.PrimaryScreen.WorkingArea.Height - this.Height;
var serialNumber = Nusbio.Detect();
if (serialNumber == null)
this.SetMessage("Nusbio not detected");
_nusbio = new Nusbio(serialNumber);
this.UpdateLampButtonText();
private void butLamp_Click(object sender, EventArgs e)
_nusbio[NusbioGpio.Gpio0].DigitalWrite(!_nusbio[NusbioGpio.Gpio0].State);
this.UpdateLampButtonText();
private void UpdateLampButtonText()
this.butLamp.Text = string.Format("Lamp {0}", _nusbio[NusbioGpio.Gpio0].State ? "On" : "Off");
private void Form1_FormClosing(object sender, FormClosingEventArgs e)