3. Case 01: Rubber Bands Launcher#

3.1. Purpose#


Make a rubber bands launcher through NezhaA Inventor’s Kit. ../../_images/neza-a-case-01-01.png

3.3. Materials Required#


../../_images/neza-a-case-01-02.png

3.4. Assembly steps#


../../_images/neza-a-step-01-01.png ../../_images/neza-a-step-01-02.png ../../_images/neza-a-step-01-03.png ../../_images/neza-a-step-01-04.png ../../_images/neza-a-step-01-05.png ../../_images/neza-a-step-01-06.png ../../_images/neza-a-step-01-07.png ../../_images/neza-a-step-01-08.png ../../_images/neza-a-step-01-09.png ../../_images/neza-a-step-01-10.png ../../_images/neza-a-step-01-11.png ../../_images/neza-a-step-01-12.png ../../_images/neza-a-step-01-13.png ../../_images/neza-a-step-01-14.png ../../_images/neza-a-step-01-15.png ../../_images/neza-a-step-01-16.png ../../_images/neza-a-step-01-17.png ../../_images/neza-a-step-01-18.png ../../_images/neza-a-step-01-19.png ../../_images/neza-a-step-01-20.png ../../_images/neza-a-step-01-21.png ../../_images/neza-a-step-01-22.png ../../_images/neza-a-step-01-23.png ../../_images/neza-a-step-01-24.png ../../_images/neza-a-step-01-25.png ../../_images/neza-a-step-01-26.png ../../_images/neza-a-step-01-27.png ../../_images/neza-a-step-01-28.png ../../_images/neza-a-step-01-29.png ../../_images/neza-a-step-01-30.png ../../_images/neza-a-step-01-31.png ../../_images/neza-a-step-01-32.png ../../_images/neza-a-step-01-33.png ../../_images/neza-a-step-01-34.png

Wrap the rubber bands with the device: ../../_images/neza-a-case-01-03.gif

3.5. Hardware Connection#


Connect the two buttons to J1 port and the Servo to S1 port on Nezha-A master box. ../../_images/neza-a-case-01-04.png

3.6. Programming#


3.6.1. Prepare the programming#

Steps for preparation please refer to: Arduino 3 in 1 Breakout Board Import the libraries and the subsidiary libraries of Nezha-A master box and then import the libraries of the two buttons: PlanetXButton-main.zip Download and import the self-defined library connections for Nezha-A master box: RJPins-main.zip

3.6.2. Sample Code:#

#include <PlanetXButton.h>
#include <NezhaA.h>
#include <RJPins.h>

PlanetXButton buttonJ1(J1);    //Create an instance of PlanetXButton category
NezhaA nezhaA;    //Create an instance of NezhaA category

void setup() {
  nezhaA.begin();    //Initiliaze the buzzer, motor, servo and light
}

void loop() {
  if (buttonJ1.isPressed(C)) {    //While button C is pressed
    nezhaA.setServoAngle(S1, 190);    //Set the angle of the servo as 200 degrees at S1 port. 
  }
  if (buttonJ1.isPressed(D)) {
    nezhaA.setServoAngle(S1, 270);    
  }
}

3.6.3. Result#

Control the rubber band through this rubber band launcher. ../../_images/neza-a-case-01-05.gif

Note The angle of the servo that controls the launch needs to be adjusted according to the number of rubber bands. Using too many rubber bands will cause excessive tension and damage the servos. It is recommended that no more than three rubber bands be used for launching.