Arduino Box

10,621

79

6

Introduction: Arduino Box

Objective:

The objective of this project was to make a case for an Arduino (MEGA).

This box need to open and close with a button and the other objective of this project was my developing 3D design.

Step 1: Design

For the design of this arduino box I used the trinkerCAD

Step 2: The Box

Step 3: Problems

I went through many problems since making the hinge to where and how to place the button.

Step 4: Attempts Servos Arm

Step 5: Servo´s Arm

Step 6: Programming

//Button Toggle Servo

#include

Servo servo; // create servo object to control a servo

// twelve servo objects can be created on most boards

const int buttonPin = 2;

boolean lastState = LOW;//storage for last button state

boolean pos = true;

void setup()

{

servo.attach(9); // attaches the servo on pin 9 to the servo object

pinMode(buttonPin, INPUT_PULLUP);//this time we will set the pin as INPUT

Serial.begin(9600);//initialize Serial connection

}

void loop()

{

boolean currentState = digitalRead(buttonPin);

if (currentState == LOW && lastState == HIGH)

{

Serial.println(pos ? "up" : "down");

servo.write(pos ? 90 : 0);

delay(150);

pos = !pos;

}

lastState = currentState;

Step 7:

Step 8:

Be the First to Share

    Recommendations

    • Puzzles Speed Challenge

      Puzzles Speed Challenge
    • CNC Contest 2020

      CNC Contest 2020
    • Secret Compartment Challenge

      Secret Compartment Challenge

    6 Discussions

    0
    ravijag
    ravijag

    1 year ago

    I borrowed my daughter's unused pencil box and cut some access holes to make a case in similar lines but not so sophisticated ! :)

    0
    Ch.S
    Ch.S

    2 years ago

    J'ai commencé,
    Merci pour cette idée , c'est vraiment cool. Comme nous débutons en Impression 3D, c'est nettement moins bien fait que la votre, mais cela est agréable à faire.

    0
    Build_it_Bob
    Build_it_Bob

    3 years ago

    Very nice work; I am sure you will be able to customize this to suit many creations.

    Thank you for sharing.

    Build_it_Bob

    0
    Gugalu
    Gugalu

    Reply 4 years ago

    Thank you !