using System;
using Microsoft.SPOT;
using System.Threading;
namespace MyAPP
{
public class Program
{
public static void Main()
{
Gadgeteer.Modules.GHIElectronics.LEDStrip ledStrip = new Gadgeteer.Modules.GHIElectronics.LEDStrip(0);
for (var i = 0; i < ledStrip.LedCount; i++)
{
ledStrip.TurnLedOff(i);
Thread.Sleep(200);
}
for (var i = 0; i < ledStrip.LedCount; i++)
{
ledStrip.TurnLedOff(i);
Thread.Sleep(200);
}
ledStrip.TurnAllLedsOn();
Thread.Sleep(500);
ledStrip.TurnAllLedsOff();
Thread.Sleep(500);
}
}
}
after starting debugin and deploy
i get message
An unhandled exception of type ‘Gadgeteer.Socket.InvalidSocketException’ occurred in Gadgeteer.dll
Additional information: Module LEDStrip cannot be used with invalid socket number 11
using System;
using System.Threading;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;
namespace GadgeteerApp2
{
public partial class Program
{
void ProgramStarted()
{
while(true)
{
for (var i = 0; i < this.ledStrip.LedCount; i++)
{
this.ledStrip.TurnLedOn(i);
Thread.Sleep(200);
}
for (var i = 0; i < this.ledStrip.LedCount; i++)
{
this.ledStrip.TurnLedOff(i);
Thread.Sleep(200);
}
this.ledStrip.TurnAllLedsOn();
Thread.Sleep(500);
this.ledStrip.TurnAllLedsOff();
Thread.Sleep(500);
}
}
}
}
Another more less code with pure .NET not throught gadgeter project but throuht MicroFramework Project -> Console App
using MS Visual Studio 2015 and last GHI tools 2016…
using System;
using System.Threading;
using Microsoft.SPOT;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;
namespace DirectMode
{
public class Program
{
public static void Main()
{
// Debug.Print(Resources.GetString(Resources.StringResources.String1));
GHIElectronics.Gadgeteer.FEZSpiderII fs2= new GHIElectronics.Gadgeteer.FEZSpiderII();
LEDStrip ledStrip = new LEDStrip(11);
while (true)
{
for (var i = 0; i < ledStrip.LedCount; i++)
{
ledStrip.TurnLedOn(i);
Thread.Sleep(200);
}
for (var i = 0; i < ledStrip.LedCount; i++)
{
ledStrip.TurnLedOff(i);
Thread.Sleep(200);
}
ledStrip.TurnAllLedsOn();
Thread.Sleep(500);
ledStrip.TurnAllLedsOff();
Thread.Sleep(500);
}
}
}
}
my first impression was
fast upload ,good and easy deployment
nice tools from GHI Peoples so now i could play in .NET
(becayse yesterday i burn Stm32F407VGT6 by just pluging OTG cable chip set fire)
while(true) i used because of similiar way to ATMEL/PIC
i don’t want to use gadgeter way
(because of no support in future)
but just drivers and console mode (pure .Net) maybe TinyClrOS is what i want.
But for now all what i want is to use arduino sensors too.
dht11,hc-sr04,pir,leds,i2c oled 128x64,i2c 1602 lcd,dust sensors,sim800e,mfrc522 rfid,rdm630 rfid etc
i have a little questions did exist those libraries and schema which pins are used on each socket on Fez Spider II to be able to use with those Arduino sensors.
Gadgeteer framework as it stands is still fine, if you want to use it. But it’s not necessary if you are happy just to use standard netmf (and TinyCLR OS when it’s available). Just remember to let ProgramStarted() finish when you do
Most of those devices will be no trouble. If you look on Codeshare (search box above, change the dropdown to codeshare) for each of them you’ll likely find many of them in code examples ready to use - you might just need to watch netmf version differences as many of them may not have been updated from when they were written.
As far as schematics go, head over to the Fez Spider II page and you’ll see the resources listed there. And for pin mapping / functions, you can see the Gadgeteer info in the section on the right of the support page[url]https://www.ghielectronics.com/support/netmf[/url].