Sie sind auf Seite 1von 21

Dr.

David Kaeli
EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

Lab Assignment 9
Group #12
Jay Chinnaswamy
chinnaswamy.ja@husky.neu.edu

Colleen Gallagher
Gallagher.co@husky.neu.edu

Submit date: 1/16/17


Due Date: 12/3/2014

Abstract
The main purpose of this lab was to bring all of the components together that have been
developed thus far over the span of the course. Specifically, the programs will be designed using
hardware and software. The robotic arm is controlled through the FPGA and the ARM processor

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

on the Zedboard controls the FPGA. The program is written in C that receives signals from the
Wiimote connected via Bluetooth and sends commands to the FPGA to carry out a specific
movement by the robotic arm. The FPGA will generate the proper Pulse Width Modulation
signals to control the robotic arm using specific servo motors. This lab allowed for students to
build upon previous knowledge of digital design, programming in C, and implementing pulse
width modulation signals to control the robotic arm.

Introduction
The goal of this lab was to design digital logic in Simulink and implement C programs
using Linux to control various aspects of the robotic arm through pulse width modulation
signals. Users have developed a C program as well as digital design models to control the arm in
previous labs, but this time, both hardware and software will be combined to control the
movement of the robotic arm using the Wiimote. Previous concepts such as PWM, memory
components, and switches were reviewed and applied to digital design in order to allow the
buttons and switches to control the robotic arms position and servo motor. Other concepts
included getting feedback from the Wiimote accelerometers and buttons and using these values
to control the position and servo motor of the robotic arm. This lab assumes that its users know
how to manipulate pulse width signals as well as utilize both digital design logic and
programming in C to control the FPGA and the movements of the arm. The constraint of this lab
was that it took a long time to set up because the Simulink model had to be re-downloaded onto
the FPGA each time as well as connecting the Wiimote with the Bluetooth receiver on the
Zedboard. This made it difficult to get things done quickly and debug the program appropriately.
it was not as straightforward as the lab involving code to control the arm.
2

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

Lab Discussion
The prelab for this assignment was to review the materials provided on Blackboard about
AXI-Lite protocol as well as the Simulink models (Base_Model_SW and Base_Model_HW) and
the C programs (Lab9.SW.c and Lab9_HW.c). Lastly, it was important for students to review the
steps taken and implementation processes of the previous lab, lab 8. The materials used in this
lab included the Zedboard, the Robotic arm with its 5 servo motors, the Pmod connectors (JA),
the Wiimote, and the ARM CPU as well as the Xilinx FPGA which are both part of the Zynq
system on the SOC chip. This was connected to the computer through an Ethernet adapter, the
USB port and the RJ45 connector on the board. The Zedboard runs on a version of Ubuntu called
Xillinux. The Robotic arm was connected through the Pmod connector (JA) on the Zedboard
where the black wire is GND, the red wire is VCC, and the yellow one is data. The Base servo
cable connects to JA0, the Bicep servo cable connects to JA1, the Elbow servo cable connects to
JA2, the Wrist servo cable connects to JA3, and the Gripper servo cable connects to JA4. System
Generator was used to design the digital logic for this because it is a plug-in to Simulink that
enables users to develop designs for Xilinx FPGAs using Matlab Simulink. The Wiimote control
was connected via the Bluetooth connector in the OTG slot on the Zedboard. Secure shell (SSH)
ran on the Mobaxterm program on the PC using the IP address 192.168.1.10 with the username
user112. The programs were written in C, complied using gcc, and ran using sudo.

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

Results and Analysis


The main challenge of this lab was to use digital design and C to control the various
servo motors and their respective movements based on the accelerometer and button readings of
the Wiimote. The first part involved using software and hardware to control the speed of a
specific servo motor of the robotic arm. This involved using the model Base_Model_SW to be
downloaded onto the FPGA which takes in 5 unsigned 8 integer inputs as the positions for the 5
servo motors, generating the 5 PWM signals for each of the 5 motors. Next, the Lab9_SW.c
program was run on Linux that took in two inputs from the user: servo number and servo
position. This allowed direct control of the arm through user inputs as well as using the
REG_WRITE function to communicate with the arm. The program was then modified to be able
to take in a third variable: speed. This can be seen in appendix A. Speed control was done by
implementing the usleep function to pause for a period of time in between each fraction of the
total distance the robot was set to move. The larger the speed value, the slower the speed that the
arm moved.
The next stage of this lab involved controlling the speed in hardware using the
Base_Model_HW Simulink model as seen in appendix D. The difference between these two
models is that the first one, the SW, had counters to control and convert the Zedboards initial
frequency and then determine which motor to move based on the signals and to generate that
PWM signal to move that motor. This model can be seen in appendix C. The HW model had 3
inputs for speed, position and enabling the robot to move. This along with various switches
allowed software to collaborate with hardware to move the arm a specific position at a specific
speed. This part also included compiling the program Lab9_HW.c which takes three inputs
4

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

from the user (position, servo motor, and speed) and writes these values to the appropriate AXI4Lite input addresses. The FPGA reads these values and then generates the proper PWM signals.
Next, this program had to be modified to cause the robot to pick up a box and throw it. This part
of the lab required a lot of testing to determine which positions for each servo motor worked best
at a certain time. This program can be seen in appendix B. This task was implemented by
creating various functions for each step of the picking up and throwing process. Each function
had specific servo motors with specific functions to move with usleep added to pause between
each step. The last part of the lab included the Wiimote to control the movements of specific
servo motors based on the accelerometer values and buttons pushed. This part of the lab can be
seen in appendix E.
Overall, the results make sense because the given instructions were followed, the digital
design and software programs were executed correctly, and the robotic arm was controlled and
moved just as expected using the Wiimote. The only real source of error in this lab was that
downloading the design onto the FPGA and connecting the Wiimote using Bluetooth took a good
amount of time and it was difficult to determine what specifically was causing the error and be
able to test it in a timely manner.

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

Conclusion
The lab was definitely one of the more difficult labs because it combined all concepts
learned and methods implemented over the span of this class. As a result, it provided more of a
challenge, therefore expanding the knowledge and the digital design as well as software abilities
of its users. From a larger perspective, the results of this lab show that it is important to
understand how the robotic arm can be controlled from combined implementations of software
and hardware utilizing tools such as the Wiimote. In the future, work could be done to simplify
the program and make it more user friendly, but the work completed fulfils the requirements
asked in this lab.

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

References
[1] Alshawabkeh, Sammy. Pulse-Width Modulation. 13 Nov. 2014. PDF file.
[2] Debouncing a Switch. 13 Nov. 2014. PDF file.
[3] "HDL Coder Getting Started Guide." Matlab. MathWorks. The MathWorks Inc. Web. 13 Nov.
2014.
[4] Patt, Yale N., and Sanjay J. Patel. Introduction to Computing Sciences: From Bits and Gates
to C & Beyond. New York: McGraw-Hill, 2004. Print.
[5] Xilinx, Inc. AXI Reference Guide (n.d.): n. pag. Xilinx. 15 Nov. 2012. Web. 1 Dec. 2014.

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

Appendix
[A]
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <time.h>
#define BASE_ADDRESS 0x400D0000
//Servo motor offsets
#define Base_OFFSET 0x100
#define Bicep_OFFSET 0x104
#define Elbow_OFFSET 0x108
#define Wrist_OFFSET 0x10C
#define Gripper_OFFSET 0x110
#define REG_WRITE(addr, off, val) (*(volatile int*)(addr+off)=(val))
//This function takes the servo number and the position, and writes the values in appropriate
address for the FPGA
void servo_move(unsigned char *test_base, int servo_number, int position, int speed);
int main()
{
//Declarations and initialization
int servo_number = 0;
int position = 0;
int speed = 0;
int i;
//Open the file regarding memory mapped IO to write values for the FPGA
int fd = open( "/dev/mem", O_RDWR);
printf("\n------------- Robot TESTING --------------------\n\n");
unsigned long int PhysicalAddress = BASE_ADDRESS;
int map_len = 0xFF;
unsigned char *test_base = (unsigned char*)mmap(NULL, map_len, PROT_READ |
PROT_WRITE, MAP_SHARED, fd, (off_t)PhysicalAddress);
if(test_base == MAP_FAILED)
{
8

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

perror("Mapping memory for absolute memory access failed -- Test Try\n");


return;
}
//Initialize all servo motors
REG_WRITE(test_base, Base_OFFSET, 180);
REG_WRITE(test_base, Bicep_OFFSET, 190);
REG_WRITE(test_base, Elbow_OFFSET, 60);
REG_WRITE(test_base, Wrist_OFFSET, 100);
REG_WRITE(test_base, Gripper_OFFSET, 150);
while(1) {
printf("Enter servo number (1-5) or enter 0 to exit:\n");
scanf("%d", &servo_number); //Take the servo number from user
if (servo_number == 0){
return 0; //Exit if the servo numner is 0
}
printf("Enter position (60 - 240):\n");
scanf("%d", &position); //Take the position from user
printf("Enter speed value: \n");
scanf("%d", &speed);
servo_move(test_base, servo_number, position, speed); //The selected servo will move to the
desired position
}
// Releasing the mapping in memory
munmap((void *)test_base, map_len);
close(fd);
return 0;
}
//This function takes the servo number and the position, and writes the values in appropriate
address for the FPGA
void servo_move(unsigned char *test_base, int servo_number, int position, int speed) {
int i;
int newPosition;
switch (servo_number) {
case 1: //Base
//newPosition= position-150;
//newPosition = abs(newPosition);
//newPosition = position;
for(i=0;i<(position/speed);i++){
9

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

REG_WRITE(test_base, Base_OFFSET, (position/speed));


usleep(1000000);
}
break;
case 2: //Bicep
REG_WRITE(test_base, Bicep_OFFSET, position);
break;
case 3: //Elbow
REG_WRITE(test_base, Elbow_OFFSET, position);
break;
case 4: //Wrist
REG_WRITE(test_base, Wrist_OFFSET, position);
break;
case 5: //Gripper
REG_WRITE(test_base, Gripper_OFFSET, position);
break;
default:
break;
}
}

[B]
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <time.h>
#define BASE_ADDRESS 0x400D0000
//Servo motor offsets
#define Base_OFFSET 0x100
#define Bicep_OFFSET 0x104
#define Elbow_OFFSET 0x108
#define Wrist_OFFSET 0x10C
#define Gripper_OFFSET 0x110
10

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

//Speed offset
#define Speed_OFFSET 0x114
#define REG_WRITE(addr, off, val) (*(volatile int*)(addr+off)=(val))
//This function takes the servo number, the speed, and the position, and writes the values in
appropriate address for the FPGA
void servo_move(unsigned char *test_base, int servo_number, int speed, int position);
void stageOne(unsigned char *test_base);
void stageTwo(unsigned char *test_base);
void stageThree(unsigned char *test_base);
int main()
{
// Declarations and initialization
int servo_number = 0;
int position = 0;
int speed = 0;
//Open the file regarding memory mapped IO to write values for the FPGA
int fd = open( "/dev/mem", O_RDWR);
printf("\n------------- Robot TESTING --------------------\n\n");
unsigned long int PhysicalAddress = BASE_ADDRESS;
int map_len = 0xFF;
// Reserve addresses in memory using mmap
unsigned char *test_base = (unsigned char*)mmap(NULL, map_len, PROT_READ |
PROT_WRITE, MAP_SHARED, fd, (off_t)PhysicalAddress);
if(test_base == MAP_FAILED)
{
perror("Mapping memory for absolute memory access failed -- Test Try\n");
return;
}
//Initialize all servo motors
REG_WRITE(test_base, Base_OFFSET, 150);
REG_WRITE(test_base, Bicep_OFFSET, 190);
REG_WRITE(test_base, Elbow_OFFSET, 190);
REG_WRITE(test_base, Wrist_OFFSET, 100);
REG_WRITE(test_base, Gripper_OFFSET, 150);
/* while(1){
11

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

printf("Enter servo number (1-5) or enter 0 to exit:\n");


scanf("%d", &servo_number); //Take the servo number from user
if (servo_number == 0)
return 0; //Exit if the servo numner is 0
printf("Enter speed (1-5):\n");
scanf("%d", &speed); //Take the speed from user
printf("Enter position (60 - 240):\n");
scanf("%d", &position); //Take the position from user
servo_move(test_base, servo_number, speed, position); //The selected servo will move to the
desired position
} */
/*servo_move(test_base, 1, 2, 120);
servo_move(test_base, 2, 2, 120);
servo_move(test_base, 3, 2, 120);
servo_move(test_base, 4, 2, 120);
servo_move(test_base, 5, 2, 120);
//stage 0
servo_move(test_base, 1, 2,
servo_move(test_base, 2, 2,
servo_move(test_base, 3, 2,
servo_move(test_base, 4, 2,
servo_move(test_base, 5, 2,
//stage 1
servo_move(test_base, 2, 2,
servo_move(test_base, 4, 2,
servo_move(test_base, 5, 2,
*/

240);
150);
150);
150);
240);
240);
150);
60);

stageOne(test_base);
munmap((void *)test_base, map_len); // Releasing the mapping in memory
close(fd);
return 0;
}
//This function takes the servo number, the speed, and the position, and writes the values in
appropriate address for the FPGA
12

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

void stageOne(unsigned char *test_base){


servo_move(test_base, 1, 2, 240);
servo_move(test_base, 2, 2, 150);
servo_move(test_base, 3, 2, 150);
servo_move(test_base, 4, 2, 150);
servo_move(test_base, 5, 2, 240);
usleep(5000000);
stageTwo(test_base);
}
void stageTwo(unsigned char *test_base){
servo_move(test_base, 2, 2, 240);
servo_move(test_base, 4, 2, 180);
servo_move(test_base, 5, 2, 60);
usleep(5000000);
stageThree(test_base);
}
void stageThree(unsigned char *test_base){
servo_move(test_base, 4, 5, 100);
servo_move(test_base, 2, 5, 160);
servo_move(test_base, 5, 5, 150);
servo_move(test_base, 2, 5, 140);
}
void servo_move(unsigned char *test_base, int servo_number, int speed, int position) {
REG_WRITE(test_base, Speed_OFFSET, speed); //Write the speed value for the FPGA
switch (servo_number) {
case 1: //Base
REG_WRITE(test_base, Base_OFFSET, position);
break;
case 2: //Bicep
REG_WRITE(test_base, Bicep_OFFSET, position);
break;
case 3: //Elbow
REG_WRITE(test_base, Elbow_OFFSET, position);
break;
case 4: //Wrist
13

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

REG_WRITE(test_base, Wrist_OFFSET, position);


break;
case 5: //Gripper
REG_WRITE(test_base, Gripper_OFFSET, position);
break;
default:
break;
}
}

[C]

14

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

[D]

15

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

[E]
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <time.h>
#define BASE_ADDRESS 0x400D0000
//Servo motor offsets
#define Base_OFFSET 0x100
#define Bicep_OFFSET 0x104
#define Elbow_OFFSET 0x108
#define Wrist_OFFSET 0x10C
#define Gripper_OFFSET 0x110
//Speed offset
#define Speed_OFFSET 0x114
#define REG_WRITE(addr, off, val) (*(volatile int*)(addr+off)=(val))
/************ constants ****************/
/** Event 2 is of 32 chars in size*/
#define WIIMOTE_EVT2_PKT_SIZE 32
/** device file name for event 2 */
#define WIIMOTE_EVT2_FNAME "/dev/input/event2"
/** the code is placed in byte 10 */
#define WIIMOTE_EVT2_CODE 10
/** value is placed in byte 12 */
#define WIIMOTE_EVT2_VALUE 12
/** Event 2 is of 32 chars in size*/
#define WIIMOTE_EVT0_PKT_SIZE 16
/** device file name for event 2 */
#define WIIMOTE_EVT0_FNAME "/dev/input/event0"
/** the code is placed in byte 10 */
#define WIIMOTE_EVT0_CODE 10
/** code for X acceleration */
#define WIIMOTE_EVT0_ACCEL_X 3
/** code for Y acceleration */

16

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

#define WIIMOTE_EVT0_ACCEL_Y 4
/** code for Z acceleration */
#define WIIMOTE_EVT0_ACCEL_Z 5
/** high portion of value is placed in byte 13 */
#define WIIMOTE_EVT0_VALUE_H 13
/** high portion of value is placed in byte 12 */
#define WIIMOTE_EVT0_VALUE_L 12
/************ types ****************/
/**
* WiiMote Button Event
*/
typedef struct {
unsigned char code; /// event 2 code
unsigned char value; /// event 2 value
} tWiiMoteButton;
/**
* WiiMote accelerator Event
*/
typedef struct {
unsigned char code; /// event 0 code
signed short value; /// event 0 value
} tWiiMoteAccel;
/**
* structure for WiiMote object
*/
typedef struct {
int fileEvt2; // file desriptor for event 2
int fileEvt0; // file descriptor for event 0
} tWiiMote;
/** instantiate one WiiMote object. It is assumed to be a singleton
* for this application (i.e. exactly one instance)
*/
tWiiMote gWiiMote;
/************ functions ****************/
/**
* Initialize WiiMote accelerometer and button read
* @return 0 on success, != 0 otherwise.
*/
int wiimote_init(void){
//Opens the event2 file in read only mode
// also set O_NONBLOCK which makes read calls non blocking, i.e. if less data is available

17

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

// than asked for, the read call returns and errno is set to EWOULDBLOCK
gWiiMote.fileEvt2 = open(WIIMOTE_EVT2_FNAME , O_RDONLY | O_NONBLOCK);
// failed to open file?
if (gWiiMote.fileEvt2 == -1) {
// error handling, print error and exit with code
printf("Could not open event file '%s'\n", WIIMOTE_EVT2_FNAME);
return -1;
}
// open file for accelerometer -- blocking
gWiiMote.fileEvt0 = open(WIIMOTE_EVT0_FNAME , O_RDONLY); //Opens the event2 file in read only
mode
// failed to open file?
if (gWiiMote.fileEvt0 == -1) {
// error handling, print error and exit with code
printf("Could not open event file '%s'\n", WIIMOTE_EVT0_FNAME);
return -1;
}
return 0;
}
/**
* get event codes for wii buttons
*
* @return button even, if no button code detected return (0,0)
*/
tWiiMoteButton wiimote_buttonGet(){
unsigned char buf[WIIMOTE_EVT2_PKT_SIZE]; // allocate data for packet buffer
tWiiMoteButton button;
// start out with nothing received
button.code = 0;
button.value = 0;
// blocking read of 32 bytes from file and put them into buf
// Without O_NONBLOCK read blocks (does not return) until sufficient bytes are available
// with O_NONBLOCK read immediately returns even if fewer bytes than asked for are availble, but it sets
// errno then.
// only continue if we got all bytes asked for.
if (WIIMOTE_EVT2_PKT_SIZE == read(gWiiMote.fileEvt2, buf, WIIMOTE_EVT2_PKT_SIZE)) {
// extract code from packet
button.code = buf[WIIMOTE_EVT2_CODE];
// extract value from packet
button.value = buf[WIIMOTE_EVT2_VALUE];
} else {

18

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

// got fewer bytes ,,,


// if error is different than it would block then report
if (errno != EWOULDBLOCK) {
printf("Unknown error %d\n", errno);
}
}
// return received button code (or none if no code received)
return button;
}
/**
* get acceleration events from wiimote
* @return acceleration event
*/
tWiiMoteAccel wiimote_accelGet() {
unsigned char buf[WIIMOTE_EVT0_PKT_SIZE]; //each packet of data is 16 bytes
unsigned char evt0ValueL; /// event 0 value Low
unsigned char evt0ValueH; /// event 0 value Low
tWiiMoteAccel accel;
accel.code = 0; // start out with nothing received
// read 16 bytes from the file and put it in the buffer
read(gWiiMote.fileEvt0, buf, WIIMOTE_EVT0_PKT_SIZE);
accel.code = buf[WIIMOTE_EVT0_CODE];

// extract code byte

// if we got an accel change


if (accel.code != 0) {
evt0ValueH = buf[WIIMOTE_EVT0_VALUE_H]; // extract high byte of accel
evt0ValueL = buf[WIIMOTE_EVT0_VALUE_L]; // extract low byte of accel
accel.value = evt0ValueH << 8 | evt0ValueL;
}
// return read accel up (may be with code 0).
return accel;
}
/**
* close the wiimote connection
*/
void wiimote_close() {
close(gWiiMote.fileEvt0); // close acceleration file
close(gWiiMote.fileEvt2); // close button file
}
/**
* Main function
* @return 0 upon success, -1 on error
*/

19

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

int main(int argc, char* argv[]) {


tWiiMoteButton button;
tWiiMoteAccel accel;
unsigned char accelX =0;
unsigned char accelY =0;
// Declarations and initialization
int servo_number = 0;
int position = 0;
int speed = 0;
//Open the file regarding memory mapped IO to write values for the FPGA
int fd = open( "/dev/mem", O_RDWR);
printf("\n------------- Robot TESTING --------------------\n\n");
unsigned long int PhysicalAddress = BASE_ADDRESS;
int map_len = 0xFF;
// Reserve addresses in memory using mmap
unsigned char *test_base = (unsigned char*)mmap(NULL, map_len, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, (off_t)PhysicalAddress);
if(test_base == MAP_FAILED)
{
perror("Mapping memory for absolute memory access failed -- Test Try\n");
return;
}
//Initialize all servo motors
REG_WRITE(test_base, Base_OFFSET, 150);
REG_WRITE(test_base, Bicep_OFFSET, 190);
REG_WRITE(test_base, Elbow_OFFSET, 190);
REG_WRITE(test_base, Wrist_OFFSET, 100);
REG_WRITE(test_base, Gripper_OFFSET, 150);
if (wiimote_init() != 0) {
printf("Failed to init WiiMote\n");
return -1;
}
do {
// read acceleration (blocking)
accel = wiimote_accelGet();
// read button events that have accumulated since then.
button = wiimote_buttonGet();
switch (button.code) {
case 0: // nothing received
break;
case 0x97: // - key
// enable / disable printing of X accel depending on if pushed / released
accelX = button.value;
REG_WRITE(test_base, Speed_OFFSET, 5);

20

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 9

REG_WRITE(test_base, Base_OFFSET, accel.value);


break;
case 0x9C: // + key
// enable / disable printing of X accel depending on if pushed / released
accelY = button.value;
REG_WRITE(test_base, Speed_OFFSET, 5);
REG_WRITE(test_base, Bicep_OFFSET, accel.value);
break;
case 0x103: // up
accelX=button.value;
REG_WRITE(test_base, Speed_OFFSET, 5);
REG_WRITE(test_base, Elbow_OFFSET, accel.value);
break;*/
case 0x48: // A
accelY=button.value;
REG_WRITE(test_base, Speed_OFFSET, 5);
REG_WRITE(test_base, Wrist_OFFSET, accel.value);
break;
case 0x49: // B
accelX=button.value;
REG_WRITE(test_base, Speed_OFFSET, 5);
REG_WRITE(test_base, Gripper_OFFSET, accel.value);
break;
}
// repeat until "Home" button is pressed (or relased)
} while(button.code != 0x3C);
wiimote_close();
return 0;
}

21

Das könnte Ihnen auch gefallen