Difference between revisions of "MCookie-LEGOShield"
From Microduino Wiki
(→Features) |
(→Specification) |
||
Line 19: | Line 19: | ||
==Specification== | ==Specification== | ||
− | *Power | + | *Power supply: Use 2S model aircraft lithium battery to supply power, 7.4V. |
− | *Master | + | *Master control: MCookie-LEGOShield adopts Atmega328p master control, and it can run driver independently. |
− | * | + | *Communication: IIC communication, and the address is 0x08(can be customized) |
− | * | + | *Interface: 4 NXT motor interfaces, and 6 NXT sensor interfaces(only S1 and S2 support the ultrasonic sensors and color sensors among them) |
{|class="wikitable" | {|class="wikitable" | ||
! rowspan="1" |MCookie pins||Shield chip pins||Function | ! rowspan="1" |MCookie pins||Shield chip pins||Function | ||
Line 38: | Line 38: | ||
|} | |} | ||
− | * | + | *Note: |
**The bit of IIC slave address of shield is adjustable, and you need to rewrite the firmware. | **The bit of IIC slave address of shield is adjustable, and you need to rewrite the firmware. | ||
*If you use shield to supply power, because the initialization of shield firmware needs a certain time, when mCookie writes the control program, you should run it after delayed for a while. | *If you use shield to supply power, because the initialization of shield firmware needs a certain time, when mCookie writes the control program, you should run it after delayed for a while. |
Revision as of 09:07, 24 August 2016
Language: | English • 中文 |
---|
ContentsFeatures
Specification
Documentsmcps17 A3906 Atmega328p DevelopmentShield adopts IIC interface communication, and the address of IIC is defaulted to 0x08, which can read and write register address just like other chips. Explanation of API interface.pdf
Use Lego NXT Interface keyCommon method: Determine Whether to PressDetermine Whether to ReleaseUse Lego NXT Interface MotorCommon method: Set a Fixed SpeedRange of speed:-255~255 #include <mCookieLEGO.h>
#include "Wire.h"
mCookieLEGO m;
void setup(){
Wire.begin();
m.configConnection(0xFFFF); //Set the connection of each interface.
}
void loop(){
m.motor_setFixedDrive(mCookieLEGO::M1, 50);
delay(1); // very important
m.motor_setFixedDrive(mCookieLEGO::M2, 50);
delay(1); // very important
m.motor_setFixedDrive(mCookieLEGO::M3, 50);
delay(1); // very important
m.motor_setFixedDrive(mCookieLEGO::M4, 50);
delay(2000);
} Use Lego NXT Interface UltrasonicCommon method: Get the Current Distance#include <mCookieLEGO.h>
#include "Wire.h"
mCookieLEGO m;
void setup(){
Wire.begin();
m.configSensorType(mCookieLEGO::S1, mCookieLEGO::SENSOR_ULTRA); // Set S1 as ultrasonic sensor.
m.configConnection(0xFFFF);
}
uint8_t dis;
void loop(){
dis = m.sensor_ultra_getDistance(mCookieLEGO::S1);
Serial.print("dis: ");
Serial.println(dis);
delay(1000);
} ApplicationPurchaseNo open purchase now. HistoryMap storageVideo |