本文整理汇总了C++中Queue::Put方法的典型用法代码示例。如果您正苦于以下问题:C++ Queue::Put方法的具体用法?C++ Queue::Put怎么用?C++ Queue::Put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Queue
的用法示例。
在下文中一共展示了Queue::Put方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
pc.baud(115200);
float temp;
pc.printf("Hello!");
//implement XBee communication
send.attach(&sendPackage,0.7);
//implement EMG signal processing
adc_aqr.attach(&adc_acquire,0.05);
adc_aqr_temp.attach(&adc_acquire_temp,0.05);
get_position.attach(&position_decide,0.05);
get_position_temp.attach(&position_decide_temp,0.05);
xbee.baud(57600);
rst = 0;
led1 = 0;
wait_ms(1);
rst = 1;
wait_ms(1);
led1 = 1;
led2 = 0;
// xbee send data
msg.id = 0;
msg.mode_send = 1;
msgIface.sendPacket( MsgTypeModeSend, (uint8_t*)&msg, sizeof(MsgModeSend) );
while ( !msgIface.sendComplete() ) {
msgIface.sendNow();
}
wait_ms(250);
led2 = 1;
wait_ms(250);
led2 = 0;
msg.id = 0;
msg.mode_send = 1;
msgIface.sendPacket( MsgTypeModeSend, (uint8_t*)&msg, sizeof(MsgModeSend) );
while ( !msgIface.sendComplete() ) {
msgIface.sendNow();
}
wait_ms(250);
led2 = 1;
wait_ms(250);
led2 = 0;
msg.id = 0;
msg.mode_send = 1;
msgIface.sendPacket( MsgTypeModeSend, (uint8_t*)&msg, sizeof(MsgModeSend) );
//Implement IMU function
imu_mpu6050.setAcceleroRange(MPU6050_ACCELERO_RANGE_2G); // set the scale of the accelerometer
imu_mpu6050.setGyroRange(MPU6050_GYRO_RANGE_250); // set the scale of the gyro
float angle_x;
float angle_y; // store the angle of x-axis and angle of y-axis
bool success_flag; // indicate the iic connection
success_flag = imu_hand.testCommunication(); // if successful, return 1
//train and get the train sample
init();
while(!success_flag) // wait until connection
{
myled = 1;
}
// while loop
t.start();
while(1) {
imu_hand.getAngleXY(&angle_x, &angle_y); // get angle_x and angle_y
myQueue.Put(&adc);
myQueue_temp.Put(&adc_temp);
//pc.printf("y: %f",angle_y);
if(pos==2&&pos==2&& angle_y>65)
{
if(mode_enable==1)
{
t.reset();
mode_enable=0;
pc.printf("SHOOT\r\n");
msg.id = 0;
msg.mode_send = SHOOT;
}
}
// pc.printf("time : %f\r\n", t.read());
// pc.printf("mode_enable : %d\r\n", mode_enable);
if(t.read()>3)
{
t.reset();
mode_enable=1;
}
if(pos==0&&pos_temp==0)
{
pc.printf("IDLE\r\n");
msg.id = 0;
//.........这里部分代码省略.........