5. Case 03: A Small Forklift#

5.1. Purpose#


Make a small forklift with NezhaA Inventor’s Kit.

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

5.2. Purchse#


NezhaA Inventor’s Kit

5.3. Materials Required#


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

5.4. Assembly Steps#


../../_images/neza-a-step-03-01.png ../../_images/neza-a-step-03-02.png ../../_images/neza-a-step-03-03.png ../../_images/neza-a-step-03-04.png ../../_images/neza-a-step-03-05.png ../../_images/neza-a-step-03-06.png ../../_images/neza-a-step-03-07.png ../../_images/neza-a-step-03-08.png ../../_images/neza-a-step-03-09.png ../../_images/neza-a-step-03-10.png ../../_images/neza-a-step-03-11.png ../../_images/neza-a-step-03-12.png ../../_images/neza-a-step-03-13.png ../../_images/neza-a-step-03-14.png ../../_images/neza-a-step-03-15.png ../../_images/neza-a-step-03-16.png ../../_images/neza-a-step-03-17.png ../../_images/neza-a-step-03-18.png ../../_images/neza-a-step-03-19.png ../../_images/neza-a-step-03-20.png ../../_images/neza-a-step-03-21.png ../../_images/neza-a-step-03-22.png ../../_images/neza-a-step-03-23.png ../../_images/neza-a-step-03-24.png ../../_images/neza-a-step-03-25.png ../../_images/neza-a-step-03-26.png ../../_images/neza-a-step-03-27.png ../../_images/neza-a-step-03-28.png ../../_images/neza-a-step-03-29.png ../../_images/neza-a-step-03-30.png ../../_images/neza-a-step-03-31.png ../../_images/neza-a-step-03-32.png ../../_images/neza-a-step-03-33.png ../../_images/neza-a-step-03-34.png ../../_images/neza-a-step-03-35.png ../../_images/neza-a-step-03-36.png ../../_images/neza-a-step-03-37.png ../../_images/neza-a-step-03-38.png ../../_images/neza-a-step-03-39.png ../../_images/neza-a-step-03-40.png ../../_images/neza-a-step-03-41.png ../../_images/neza-a-step-03-42.png ../../_images/neza-a-step-03-43.png ../../_images/neza-a-step-03-44.png ../../_images/neza-a-step-03-45.png ../../_images/neza-a-step-03-46.png ../../_images/neza-a-step-03-47.png ../../_images/neza-a-step-03-48.png ../../_images/neza-a-step-03-49.png ../../_images/neza-a-step-03-50.png

5.5. Hardware Connections#


Connect two motors to M1 and M2, the two buttons to J1 port on Nezha-A master box. ../../_images/neza-a-case-03-03.png

5.6. Programming#


5.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

5.6.2. Sample Projects:#

// Language ArduinoC
#include <RJPins.h>
#include <NezhaA.h>
#include <PlanetXButton.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.setMotorSpeed(M1, 50);   // Set the speed of the motor connecting to M1 at 50%
    delay((2) * 1000);    //Pause 2000ms
    nezhaA.brakeMotor(M1);    //Stop the motor connecting to M1
    nezhaA.setMotorSpeed(M2, 100);   //Set the speed of the motor connecting to M2 at 100%
    delay((1) * 1000);
    nezhaA.brakeMotor(M2);    //设Stop the motor connecting to M2
  }
  if (buttonJ1.isPressed(D)) {    //While button D is pressed
    nezhaA.setMotorSpeed(M1, -50);
    delay((2) * 1000);
    nezhaA.brakeMotor(M1);
    nezhaA.setMotorSpeed(M2, -100);
    delay((1) * 1000);
    nezhaA.brakeMotor(M2);
  }
}

5.6.3. Result#

After powering on, press button C and the car drives forward for 2 seconds and the raise its folklift; press button D and the car reverses for 2 seconds, then it puts the folklift down.