light sensor gadgeteer project #2. step #1 create a new gadgeteer project named: sensorgadgeteerapp...
TRANSCRIPT
![Page 1: LIGHT SENSOR GADGETEER PROJECT #2. Step #1 Create a new Gadgeteer project named: SensorGadgeteerApp Add A red power module (USBClientSP) A Light Sensor](https://reader036.vdocuments.mx/reader036/viewer/2022082818/56649eeb5503460f94bfc626/html5/thumbnails/1.jpg)
LIGHT SENSOR GADGETEER PROJECT #2
![Page 2: LIGHT SENSOR GADGETEER PROJECT #2. Step #1 Create a new Gadgeteer project named: SensorGadgeteerApp Add A red power module (USBClientSP) A Light Sensor](https://reader036.vdocuments.mx/reader036/viewer/2022082818/56649eeb5503460f94bfc626/html5/thumbnails/2.jpg)
2
Step #1• Create a new Gadgeteer project named:
• SensorGadgeteerApp
• Add• A red power module (USBClientSP)• A Light Sensor• A •LED Strip Module• Display N18 Module• Click - Connect the modules
• Physically connect modules as displayed in Visual C# Express
![Page 3: LIGHT SENSOR GADGETEER PROJECT #2. Step #1 Create a new Gadgeteer project named: SensorGadgeteerApp Add A red power module (USBClientSP) A Light Sensor](https://reader036.vdocuments.mx/reader036/viewer/2022082818/56649eeb5503460f94bfc626/html5/thumbnails/3.jpg)
3
Step #2• Output light sensor values to the Visual C# Express
output so that you see the changes as you hide the light sensor in your hands, hold it up to your monitor, etc.
• Copy your code from the potentiometer assignment to this assignment.
• Update it to base the LED output on the amount of light that the light sensor detects.
![Page 4: LIGHT SENSOR GADGETEER PROJECT #2. Step #1 Create a new Gadgeteer project named: SensorGadgeteerApp Add A red power module (USBClientSP) A Light Sensor](https://reader036.vdocuments.mx/reader036/viewer/2022082818/56649eeb5503460f94bfc626/html5/thumbnails/4.jpg)
4
Step #3• Now add your potentiometer to your project as well.• Update your code so that the potentiometer knob will set a “target light” value, this should be a value between 0
and 100 in steps of 10 (i.e. 0, 10, 20, 30, 40, …, 100) – output this value to the Visual C# Express output window only one time when it changes.
• Update your code so that anytime the light sensor value goes above or below the “target light” value a message is output to the console (exactly one message each time the target transitions above or below the target).
Example output in red:Target Light = 40
(you turn knob up)Target Light = 50
(you put sensor near monitor)Light Sensor Above Target (53.5513)
(even though light increases only 1 message – you hide sensor in your hands)Light Sensor Below Target (48.4114)
(even though light decreases only 1 message – you turn the knob down)Target Light = 40Light Sensor Above Target (48.4114)
(even though you didn’t move the light it is now above the target rather than below it so a message prints)
Raise your hand to get signed off for “Light Sensor Part 1”
![Page 5: LIGHT SENSOR GADGETEER PROJECT #2. Step #1 Create a new Gadgeteer project named: SensorGadgeteerApp Add A red power module (USBClientSP) A Light Sensor](https://reader036.vdocuments.mx/reader036/viewer/2022082818/56649eeb5503460f94bfc626/html5/thumbnails/5.jpg)
5
Step #4• Add code to put the output to the Display N18 Light
sensor values.
• Format for 2 decimal places• You choose the color• Format with the NinaB font
![Page 6: LIGHT SENSOR GADGETEER PROJECT #2. Step #1 Create a new Gadgeteer project named: SensorGadgeteerApp Add A red power module (USBClientSP) A Light Sensor](https://reader036.vdocuments.mx/reader036/viewer/2022082818/56649eeb5503460f94bfc626/html5/thumbnails/6.jpg)
6
Adding a Font Resourcefont myfont = Resources.GetFont(Resources.FontResources.NinaB)
for example:
display_N182.SimpleGraphics.DisplayText("Target Value = " + (int)target, myfont, GT.Color.Blue, 1, 1)
---or ---:
display_N182.SimpleGraphics.DisplayText("Target Value = " + (int)target, Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 1, 1)