Transcription of Studuino ライブラリ 関数リファレンス
1 Studuino 2014/11/01 2018/08/03 1 2014/11/01 2017/01/16 Studuino web 2017/8/16 2018/02/01 2018/08/03 2 1.. 3 2.. 3 .. 3 DC .. 7 .. 10 .. 12 LED .. 14 .. 15 .. 22 Studuino mini .. 23 .. 28 3.. 31 Arduino .. 31 Studuino .. 31 .. 31 .. 32 DC .. 32 .. 33 .. 35 LED .. 36 .. 37 4. Studuino DC .. 42 5.. 43 3 1.
2 Arduino IDE Studuino Studuino (DC ) 2. [ ] [ ] [ ] [ ] [ ] [ ] [ ] Studuino SetDCMotorCalibration byte[2] rate 0 100 DC DC rate[0] M1, rate[1] M2 DC // M1 DC 80% // M2 DC 100% byte calib[] = { 80, 100 }; SetDCMotorCalibration(calib).
3 // DC 4 SetServomotorCalibration char[8] offsets -15 15 offsets[0] [7] D2 D12 // D9 D12 byte calib[] = { 0, 0, 0, 0, -6, 0, 12, 3 }; // D9(-6 ), D10(0 ), D11(12 ), D12(3 ) SetServomotorCalibration(calib); // DC InitDCMotorPort byte connector PORT_M1 PORT_M2 DC DC // Move / DCMotor / DCMotorPower / DCMotorControl InitDCMotorPort(PORT_M1); // DC M1 InitServomotorPort byte connector *1 // Servomotor /SyncServomotors / AsyncServomotors InitServomotorPort(PORT_D2).
4 // D2 5 InitServomotorPortForLED byte connector PORT_D9 PORT_D10 PORT_D11 D9, D10, D11 LED D9, D10, D11 LED // Gradation InitServomotorPortForLED (PORT_D9); // LED D9 Gradation(PORT_D9, 128); InitSensorPort byte connector * 4 byte pid * 5 /LED/ /LED/ // Buzzer / BuzzerControl / Melody / LED / Get* InitSensorPort(PORT_A0, PIDLED); // LED A0 6 InitSensorPort byte connector1 * 4 byte connector2 * 4 byte pid * 5 InitSensorPort(PORT_A0, PORT_A1 ,PIDULTRASONICSENSOR).
5 // A0, A1 InitI2 CPort byte pid * 5 (I2C ) I2C (A4, A5) I2C InitI2 CPort(PIDACCELEROMETER); // InitBluetooth Bluetooth Baudrate 9600 Serial 2 RBT-001 86873 86876 InitBluetooth(); // Bluetooth 7 DC DC Move byte direct FORWARD BACKWARD FORWARD_RIGHT ( ) FORWARD_LEFT ( ) BACKWARD_RIGHT ( ) BACKWARD_LEFT ( ) CLOCKWISE COUNTERCLOCKWISE byte pace 0 255 ( ) ulong duration 0 2^32-1 byte brake BRAKE COAST DC DC DC Move (FORWARD, 10, 1000, BRAKE).
6 // 10 1 8 DCMotor byte connector PORT_M1 PORT_M2 byte rotation NORMAL REVERSE byte pace 0 255 ( ) ulong duration 0 2^32-1 byte brake BRAKE COAST DC // M1 DC 10 1 DCMotor (PORT_M1, NORMAL, 10, 1000, BRAKE); DCMotorPower byte connector PORT_M1 PORT_M2 byte pace 0 255 ( ) DC // M1 DC 10 1 100 1 DCMotorPower(PORT_M1, 10); // M1 DC DCMotorControl(PORT_M1, CLOCKWISE); // M1 DC Timer(1); // 1 DCMotorPower(PORT_M1, 100); // M1 DC Timer(1); // 1 DCMotorControl (PORT_M1, BRAKE); // M1 DC 9 DCMotorControl byte connector PORT_M1 PORT_M2 byte rotation NORMAL REVERSE BRAKE COAST DC // M1 DC 10 1 DCMotorPower(PORT_M1, 10); // M1 DC DCMotorControl(PORT_M1, CLOCKWISE); // M1 DC Timer(1000); // 1 DCMotorControl (PORT_M1, BRAKE).
7 // M1 DC 10 Servomotor byte connector *1 byte degree 0 180 1 // D2 90 Servomotor (PORT_D2, 90); AsyncServomotors byte[] connectors *1 byte[] degrees 0 180 byte number 1 8 // D2, D9, D10 90, 180, 45 byte myConectors[] = { PORT_D2, PORT_D9, PORT_D10 }; byte myDegrees[] = { 90, 180, 45}; ASyncServomotor (myConectors, myDegrees, 3); 11 SyncServomotors byte[] connector *1 byte[] degree 0 180 byte number 1 8 byte time 3 255 1 time 1 3ms time 3 3ms // D2, D9, D10 90, 180, 45 byte myConectors[] = { PORT_D2, PORT_D9, PORT_D10 }; byte myDegrees[] = { 90, 180, 45}; SyncServomotor (myConectors, myDegrees, 3, 5).
8 12 Buzzer byte connector * 3 word pitch * 6 ulong duration 0 2^32-1 Buzzer (PORT_A0, BZR_C4, 1000); // A0 1 BuzzerControl byte connector * 3 boolean onoff ON OFF byte pitch * 6 onoff ON (pitch) OFF ( pitch ) // A0 1 BuzzerControl(PORT_A0, ON, BZR_C4); Timer(1000); BuzzerControl(PORT_A0, OFF, 0); 13 Melody byte connector * 3 word[] pitches * 6 float[] beats 0 byte number (0 255) byte tempo TEMPO60 TEMPO90 TEMPO120 TEMPO150 // A0 word myPitches[] = { BZR_C3, BZR_D3, BZR_E3, BZR_F3, BZR_E3, BZR_D3, BZR_C3 }; float myBeats[] = { 1, 1, 1, 1, 1, 1, 1 }; byte num = 7; // Melody (PORT_A0, myPitches, myBeats, num, TEMPO90); 14 LED LED LED byte connector * 3 boolean onoff ON LED / OFF LED ON/OFF LED (PORT_A0, ON).
9 // A0 LED ON Gradation byte connector PORT_D9 PORT_D10 PORT_D11 byte ratio 0 255 ( ) D9, D10, D11 LED Gradation (PORT_D9, 128); // D9 LED 15 Studuino GetPushSwitchValue byte connector * 2 byte 0: , 1: // A0 byte val = GetPushSwitchValue (PORT_A0); GetTouchSensorValue byte connector * 3 byte 0: , 1: // A0 byte val = GetTouchSensorValue (PORT_A0); GetLightSensorValue byte connector * 4 int 0 1023 int val = GetLightSensorValue (PORT_A0); // A0 GetSoundSensorValue byte connector * 4 int 0 1023 int val = GetSoundSensorValue (PORT_A0).
10 // A0 16 GetIRPhotoreflectorValue byte connector * 4 int 0 1023 // A0 int val = GetIRPhotoreflectorValue (PORT_A0); GetAccelerometerValue byte axis X_AXIS Y_AXIS Z_AXIS int -128 127 I2C A4,A5 int val = GetAccelerometerValue (X_AXIS); // X GetTemperatureSensorValue byte connector * 5 int 0~1023 int val = GetTemperatureSensorValue(PORT_A0); // A0 double temperature = ((((val / ) * ) - ) / ); // 17 GetUltrasonicSensorValue byte trigger * 4 byte echo * 4 unsigned long triggerPin echoPin ( ) unsigned long val = GetUltras