LEGO MINDSTORMS - The Unofficial Guide to Robots - Jonathan B. Knudsen Part 9

Tham khảo tài liệu 'lego mindstorms - the unofficial guide to robots - jonathan b. knudsen part 9', kỹ thuật - công nghệ, cơ khí - chế tạo máy phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 150 Put the joystick from Step 5 into the assemblies from Step 6. Fasten it together with the two yellow plates. Then put the whole thing on the remote assembly. When you wiggle the joystick back and forth it pushes one or the other touch sensor. Step 8 might not look like much but it s important. It s the slider that controls Minerva s arm. It slides past the light sensor presenting either a yellow or a black brick to the sensor. This is how the RCX knows if you ve moved the slider. In Step 9 the slider gets mounted on the remote. Make sure it slides freely and note that it s upside-down with respect to the rest of the construction. The orientation of the yellow and black bricks in the slider will make a difference in how the arm is controlled. If you don t like how it works when it s all together you can always switch it around later. 151 Programming the Remote Control The remote control doesn t really have to do much. It responds to its sensors by sending commands to Minerva. The joystick control triggers the two touch sensors the remote responds to these by telling Minerva to move forward or spin. The slider control is used to move Minerva s arm up or down. One final feature is a heartbeat a special message that the remote periodically sends to Minerva. If Minerva doesn t hear this message it knows it has lost contact with the remote. The remote uses three different tasks to get everything done. One task monitors the touch sensors one task monitors the light sensor and the third task sends the heartbeat signal. Here is the code for those tasks define FORWARD_MESSAGE 16 define SPIN_MESSAGE 17 define STOP_MESSAGE 18 define GRAB_MESSAGE 19 define RELEASE_MESSAGE 20 define HEARTBEAT_MESSAGE 21 define HEARTBEAT_TIME 20 task main SetSensor SENSOR_1 SENSOR_LIGHT SetSensor SENSOR_2 SENSOR_TOUCH SetSensor SENSOR_3 SENSOR_TOUCH 152 start lightWatcher start touchWatcher start heartbeat task touchWatcher while true if SENSOR_2 1 SendMessage FORWARD_MESSAGE Wait 10 until .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.