public static void Main() { const SPI.SPI_module spiBus = SPI.SPI_module.SPI3; const Cpu.Pin chipSelectPin = Stm32F4Discovery.FreePins.PA15; const Cpu.Pin interruptPin = Stm32F4Discovery.FreePins.PD1; const string hostname = "stm32f4"; var mac = new byte[] {0x5c, 0x86, 0x4a, 0x00, 0x00, 0xdd}; //Static IP //Adapter.IPAddress = "10.15.16.50".ToBytes(); //Adapter.Gateway = "10.15.16.1".ToBytes(); //Adapter.DomainNameServer = Adapter.Gateway; //Adapter.DomainNameServer2 = "8.8.8.8".ToBytes(); // Google DNS Server //Adapter.SubnetMask = "255.255.255.0".ToBytes(); //Adapter.DhcpDisabled = true; //Adapter.VerboseDebugging = true; Adapter.Start(mac, hostname, spiBus, interruptPin, chipSelectPin); const int minVal = 0; const int maxVal = 100; string apiUrl = @"http://www.random.org/integers/?num=1" + "&min=" + minVal + "&max=" + maxVal + "&col=1&base=10&format=plain&rnd=new"; var request = new HttpRequest(apiUrl); request.Headers.Add("Accept", "*/*"); HttpResponse response = request.Send(); if (response != null) Debug.Print("Random number: " + response.Message.Trim()); }
public static void Main() { #region Static IP example //Networking.Adapter.IPAddress = "192.168.1.95".ToBytes(); //Networking.Adapter.Gateway = "192.168.1.254".ToBytes(); //Networking.Adapter.DomainNameServer = Networking.Adapter.Gateway; //Networking.Adapter.DomainNameServer2 = "8.8.8.8".ToBytes(); // Google DNS Server //Networking.Adapter.DhcpDisabled = true; #endregion // http://forums.netduino.com/index.php?/topic/322-experimental-drivers-for-wiznet-based-ethernet-shields/page__view__findpost__p__3170 // 5C-86-4A-00-00-DD This is a test MAC address from Secret Labs // Note: This MAC address should be Unique, but it should work fine on a local network (as long as there is only one instance running with this MAC) Networking.Adapter.Start(new byte[] { 0x5c, 0x86, 0x4a, 0x00, 0x00, 0xdd }, "mip", InterfaceProfile.NetduinoGo_Socket3_ENC28); // This is a call to the OData REST web server hosted by netflix. Just Ctrl-Click the link to see what it does. var r = new HttpRequest("http://odata.netflix.com/Catalog/Titles('BVIuO')/Synopsis/$value"); r.Headers.Add("Accept", "*/*"); // Add custom properties to the Request Header var response = r.Send(); if (response != null) Debug.Print("Response: " + response.Message); }