public static void Main() { led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState); config = new I2CDevice.Configuration(address, clockRateKHz); device = new I2CDevice(config); WIZnet_W5100.Enable(SPI.SPI_module.SPI1, (Cpu.Pin)FEZ_Pin.Digital.Di10, (Cpu.Pin)FEZ_Pin.Digital.Di7, true); Dhcp.EnableDhcp(new byte[] { 0x00, 0x26, 0x1C, 0x7B, 0x29, 0xE8 }, "tt"); while (true) { uploadData(gatherData()); getHeaterStatus(); setHeaterStatus(); Thread.Sleep(updateTime); } }
/// <summary> /// Initialize connection /// </summary> public DataPointService(Credentials credentials, string projectName, string hubId, int intervalMilliseconds) { // Configure Internet connection byte[] mac = { 0x00, 0x26, 0x1C, 0x7B, 0x29, 0xE8 }; string hostname = "idiotsdk"; WIZnet_W5100.Enable(SPI.SPI_module.SPI1, (Cpu.Pin)FEZ_Pin.Digital.Di10, (Cpu.Pin)FEZ_Pin.Digital.Di7, true); Dhcp.EnableDhcp(mac, hostname); Dhcp.RenewDhcpLease(); // Set current time NTPTime("pool.ntp.org"); // Set interval between requests this.RequestInterval = intervalMilliseconds; this.username = credentials.Username; this.credentials = credentials; this.projectName = projectName; this.hubId = hubId; // TODO: Display info on screen module }
/// <summary> /// Initalizes the network shield to use a DHCP connection and the provided MAC address. /// </summary> /// <param name="mac"> /// This must be a unique MAC address value represented as a byte array. /// Here is a resource for generating random MAC addresses: http://www.macvendorlookup.com/ /// </param> public static void Initialize(byte[] mac) { // Configure the ethernet port WIZnet_W5100.Enable(SPI.SPI_module.SPI1, (Cpu.Pin)FEZ_Pin.Digital.Di10, (Cpu.Pin)FEZ_Pin.Digital.Di9, true); // WIZnet interface on FEZ Panda Dhcp.EnableDhcp(mac, "FEZDomino"); }