Michael Brucato
Published © GPL3+

Th LockBox

This is supposed to act like a lock, or present itself like one. This is my housing unit for my Circuit Playground Arduino Module

BeginnerFull instructions provided4 hours32
Th LockBox

Things used in this project

Hardware components

Circuit Playground Express
Adafruit Circuit Playground Express
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Alligator Clips
Alligator Clips
×3

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Box, General Purpose
Box, General Purpose

Story

Read more

Schematics

Circuit Diagram

Basically, when the CPE is turned on, a current runs from the module, to the potentiometer and then back to the CPE through two different wires. There is a third wire connected to the input so that the potentiometer can be used to control/modify the signal sent to the main module.

Code

Switches and Knobs Code

Arduino
It works a lot like a lock. You just twist the potentiometer. As you turn the potentiometer, the CPE starts lighting up green until it reaches a certain point, which "unlocks" the module and then it starts flashing Yellow, showing you that you unlocked it.
#include <Adafruit_CircuitPlayground.h>

uint16_t value;
uint8_t pixels;

void setup() {
  Serial.begin(9600);
  CircuitPlayground.begin();
}

void loop() {
  value = analogRead(10);
  pixels = map(value, 0, 1023, 0, 10);
  
  CircuitPlayground.clearPixels();
  for (int p=0; p<pixels; p++) {
    CircuitPlayground.setPixelColor(p-1, 0x000000);
    CircuitPlayground.setPixelColor(p, 0x00FF00);
    if (p == 6){
      CircuitPlayground.clearPixels();
      CircuitPlayground.redLED(HIGH);
      delay(250);
      CircuitPlayground.redLED(LOW);
      delay(250);
      for ( int i = 0; i<10; i++) {
        CircuitPlayground.setPixelColor(i, 0xFFFF00);
      }
    delay(1500);
    } 
  }
  delay(100);
}
 

Credits

Michael Brucato
4 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.