New Homepage Forums Sensor Shields 1Sheeld No Y Axis via iPhone8

This topic contains 1 reply, has 1 voice, and was last updated by avatar Atu2 11 months, 4 weeks ago. This post has been viewed 110 times

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #123507
    avatarAtu2
    Participant

    I’m having trouble completing tutorial “Control Robotic Arm with your hand gestures via Arduino and 1Sheeld.” The robotic arm works perfectly except for the servo assigned to the Y axis.

    This project uses 4 servos. One for each axis – X,Y,Z, plus one for the proximity data. I have three servos (X, Z, and Proximity) responding properly. The fourth servo for the Y axis remains motionless. The exception is – at the conclusion of sketch upload when some servos respond with the quick data pulse.

    The hardware config. Is: 1Sheeld is mounted on an Arduino Mega. Communications is via iPhone8 and a MacBook Pro. All software are current.

    The code is simply copy and paste from the tutorial. I have explored variations from that original code but the results are identical. These variants include changes to pin assignments in order to eliminate hardware issues. Alone the same line I have swapped jumpers, and servos. Multiple 1Sheelds, Arduinos, and iPhones have been all produced the same result. — no action related to the Y data.

    Questions:
    Does the 1Sheeld’s library preference Android over iPhone?
    The 1Sheeld library was place in the Arduino Library folders using “show package content” (a Mac thing?) and shows up properly in Arduino’s “Include Library.” Still could that be a factor… Library location? It looks and acts correctly.
    Is my programmer selection “Arduino ISP” a factor?
    Code is entered with simple copy and paste. I’ve spent days pouring through each line and making adjustments all of which have produced the exact same results… No “Y” action.

    Thank you for any insight,

    The code used is included here as an attachment:

    #123514
    avatarAtu2
    Participant

    I did not see my attached code so adding it here. I’m new and not familiar. Hope this come out right.

    #include <Servo.h>
    #include <OneSheeld.h>

    Servo myservo1;
    Servo myservo2;
    Servo myservo4;
    Servo myservo5;
    Servo myservo6;

    void setup()
    {
    OneSheeld.begin();

    myservo1.attach(3);
    myservo1.write(0);
    myservo2.attach(5);
    myservo2.write(0);

    analogWrite(6, 200);
    analogWrite(9, 200);
    // myservo4.attach(9);
    // myservi4.write(90);

    myservo5.attach(10);
    myservo5.write(70);
    myservo6.attach(11);
    myservo6.write(10);
    }
    void loop() {

    if (ProximitySensor.getValue() > 0)
    myservo6.write(120);
    else
    myservo6.write(10);

    if (OrientationSensor.getX() > 0 && OrientationSensor.getX() <= 180)
    myservo1.write(map(abs(OrientationSensor.getX()), 0,180,180,0));

    if (OrientationSensor.getY() < -90 && OrientationSensor.getY() >= -180)
    {
    myservo2.write(map(abs(OrientationSensor.getY()),180,90,0,90));
    }

    if (OrientationSensor.getZ() > 0 && abs(OrientationSensor.getZ()) <= 60)
    myservo5.write(map(OrientationSensor.getZ(),0,60,70,100));

    if (OrientationSensor.getZ() < 0 && abs(OrientationSensor.getZ()) <= 60)
    myservo5.write(map(abs(OrientationSensor.getZ()),60,0,0,70));

    OneSheeld.processInput();
    }

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.