Back to Parent

Outcome


Working with Inputs and Sensors

In this second Skills Dev, we explored input devices and sensors and worked to combine them with if statements to produce a desired action. After working through the Lab tutorials to understand basic inputs and sensors, I created a simple 2-in 1-out device, presented with a simple use case.

Getting Inputs: Using a Pushbutton

To introduce inputs, we explore pushbuttons, and how to use one to turn on/off an LED.

Img 5754.thumb
Show Advanced Options
Show Advanced Options

Getting Inputs: Using a Switch

Next, we consider switches to turn on/off an LED. The code is the exact same as the pushbutton code.

Img 5756.thumb
Show Advanced Options
Show Advanced Options

Getting Inputs: Using a Potentiometer

Then, we look at potentiometers, which use analog input to control LED brightness across a range of values, rather than just on/off.

Img 5758.thumb
Show Advanced Options
Show Advanced Options

Working with Sensors: Using a Photoresistor

To understand sensors, we explore using a photoresistor (light sensor) to obtain ambient light readings and output these readings as brightness of an LED.

Img 5759.thumb
Show Advanced Options
Show Advanced Options

Practice Exercise: Combining Sensors and Inputs

Prepare a simple 2-in (sensors or inputs) 1-out (LED) device (i.e. your project will use three components (resistors and wire don't count!) and at least one must be a sensor). Present a really simple use case for a connected sensor device (perhaps solve a simple problem in your home).

For this final exercise, I combined a Force-Sensing Resistor and a pushbutton with an LED. If the button is pressed, then the LED will light up with a brightness proportional to the force detected on the FSR. A simple (maybe not simple) use case might be if a family member wants to communicate with you through your bedroom door, they will push the button and press the FSR according to how urgently they need you for something. This urgency will translate as LED brightness, which you are able to glance at from your desk.

Img 5760.thumb
Show Advanced Options
Show Advanced Options

Reflection & Next Steps

After going through this activity, I felt like the beginning tutorials on inputs and sensors were actually very helpful to run through and provided helpful base code to add to for future projects. I particularly enjoyed the practice exercise and the freedom/creativity it provided, since it helped me think more practically about our final project in this class.

After this activity, I will move onto Skills Dev 3. I will also use some of the things we covered (like the practice exercise) for our final project.

Drop files here or click to select

You can upload files of up to 20MB using this form.