ArduinoとJQ6500の接続はスケッチの内容を確認。 JQ6500のTX(10pin)をArduinoの8pinに、 JQ6500のRX(9pin)をArduinoの9pinに1kΩを介して接続します。 // Arduino Pin 8 is connected to TX of the JQ6500 // Arduino Pin 9 is connected to one end of a 1k resistor, // the other end of the 1k resistor is connected to RX of the JQ6500 // If your Arduino is 3v3 powered, you can omit the 1k series resistor SoftwareSerial mySerial(8, 9); JQ6500_Serial mp3(mySerial);
JQ6500_TEST_5files.ino 1/1 1: /* JQ6500_TEST_5files 2: test controls of the JQ6500 module. 3: 2021/12/12 4: 5 files simple play test 5: */ 6: 7: #include "Arduino.h" 8: #include "SoftwareSerial.h" 9: #include "JQ6500_Serial.h" 10: 11: // Create the mp3 module object, 12: // Arduino Pin 8 is connected to TX of the JQ6500 13: // Arduino Pin 9 is connected to one end of a 1k resistor, 14: // the other end of the 1k resistor is connected to RX of the JQ6500 15: // If your Arduino is 3v3 powered, you can omit the 1k series resistor 16: 17: SoftwareSerial mySerial(8, 9); 18: JQ6500_Serial mp3(mySerial); 19: int fnum ; 20: 21: void setup() { 22: Serial.begin(9600); 23: mySerial.begin(9600); 24: mp3.setVolume(20); 25: } 26: 27: void loop() { 28: for (fnum = 1 ; fnum <= 5 ; fnum++) { 29: mp3.playFileByIndexNumber(fnum); 30: delay(3000); 31: } 32: delay(3000); 33: 34: for (fnum = 5 ; fnum >= 1 ; fnum--) { 35: mp3.playFileByIndexNumber(fnum); 36: delay(3000); 37: } 38: } 39:
int pos_y; int pos_x; int motor_sp; const int motor_sp1 = 128; //超信地旋回速度 const int motor_sp0 = 0; //超低速
void setup() { Usb.Init(); Serial.begin(115200); while (!Serial); // シリアルポートが接続するのを待つ if (Usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nPS3 Bluetooth Library Started"));
/* You can create the instance of the PS4BT class in two ways */ // This will start an inquiry and then pair with the PS4 controller - you only have to do this once // You will need to hold down the PS and Share button at the same time, the PS4 controller will then start to blink rapidly indicating that it is in pairing mode PS4BT PS4(&Btd, PAIR);
// After that you can simply create the instance like so and then press the PS button on the device //PS4BT PS4(&Btd);
【変更後】
/* You can create the instance of the PS4BT class in two ways */ // This will start an inquiry and then pair with the PS4 controller - you only have to do this once // You will need to hold down the PS and Share button at the same time, the PS4 controller will then start to blink rapidly indicating that it is in pairing mode //PS4BT PS4(&Btd, PAIR);
// After that you can simply create the instance like so and then press the PS button on the device PS4BT PS4(&Btd);
Serial.begin(115200); while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection if (Usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nPS3 Bluetooth Library Started")); }
//砲撃 + リコイル if (PS3.getButtonClick(R1) && ch == 0 ) { int khz = 38; // 38kHz carrier frequency for the NEC protocol unsigned int irSignal[] = {4100, 1000, 2000, 2050, 1000}; // vs BATTLE TANK jr T-72 40MHz // AnalysIR Batch Export (IRremote) - RAW irsend.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), khz);
myservo.attach(46); //servo ピン46 (9-11ピンは使えない。) myservo_1.attach(44); //servo_1 ピン44 myservo.write(servo_pos); myservo_1.write(servo_pos); Serial.begin(115200); while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection if (Usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nPS3 Bluetooth Library Started")); }
//砲撃 + リコイル動作 + 赤外線砲撃信号発光 if (PS3.getButtonClick(R1) && ch == 0 ) { int khz = 38; // 38kHz carrier frequency for the NEC protocol unsigned int irSignal[] = {4068, 1028, 2024, 2088, 964}; // vs BATTLE TANK jr T-72 40MHz /* unsigned int irSignal[] = {4048,1068,2048,2008,1044}; vs BATTLE TANK jr エイブラムス 27MHz AnalysIR Batch Export (IRremote) - RAW */ irsend.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), khz);
Serial.begin(115200); while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection if (Usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nPS3 Bluetooth Library Started")); }
Serial.begin(115200); while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection if (Usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nPS3 Bluetooth Library Started")); }
Serial.begin(115200); while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection if (Usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nPS3 Bluetooth Library Started")); }