質問編集履歴

3

こど

2024/06/19 13:59

投稿

younet
younet

スコア2

test CHANGED
File without changes
test CHANGED
@@ -19,6 +19,78 @@
19
19
 
20
20
 
21
21
  ### 該当のソースコード
22
+ /* send.ino Example sketch for IRLib2
23
+ * Illustrates how to send a code.
24
+ */
25
+ #include <IRLibSendBase.h> // First include the send base
26
+ //Now include only the protocols you wish to actually use.
27
+ //The lowest numbered protocol should be first but remainder
28
+ //can be any order.
29
+ #include <IRLib_P01_NEC.h>
30
+ #include <IRLib_P02_Sony.h>
31
+ #include <IRLibCombo.h> // After all protocols, include this
32
+ // All of the above automatically creates a universal sending
33
+ // class called "IRsend" containing only the protocols you want.
34
+ // Now declare an instance of that sender.
35
+
36
+ IRsend mySender;
37
+
38
+ #define IR_SEND_PWM_PIN D3
39
+
40
+ void setup() {
41
+ Serial.begin(9600);
42
+ delay(2000); while (!Serial); //delay for Leonardo
43
+ Serial.println(F("Every time you press a key is a serial monitor we will send."));
44
+ }
45
+
46
+ void loop() {
47
+ if (Serial.read() != -1) {
48
+ //send a code every time a character is received from the
49
+ // serial port. You could modify this sketch to send when you
50
+ // push a button connected to an digital input pin.
51
+ //Substitute values and protocols in the following statement
52
+ // for device you have available.
53
+ mySender.send(SONY,0xa8bca, 20);//Sony DVD power A8BCA, 20 bits
54
+ //mySender.send(NEC,0x61a0f00f,0);//NEC TV power button=0x61a0f00f
55
+ Serial.println(F("Sent signal."));
56
+ }
57
+ }
58
+
59
+ /* rawR&cv.ino Example sketch for IRLib2
60
+ * Illustrate how to capture raw timing values for an unknow protocol.
61
+ * You will capture a signal using this sketch. It will output data the
62
+ * serial monitor that you can cut and paste into the "rawSend.ino"
63
+ * sketch.
64
+ */
65
+ // Recommend only use IRLibRecvPCI or IRLibRecvLoop for best results
66
+ #include <IRLibRecvPCI.h>
67
+
68
+ IRrecvPCI myReceiver(2);//pin number for the receiver
69
+
70
+ void setup() {
71
+ Serial.begin(9600);
72
+ delay(2000); while (!Serial); //delay for Leonardo
73
+ myReceiver.enableIRIn(); // Start the receiver
74
+ Serial.println(F("Ready to receive IR signals"));
75
+ }
76
+
77
+ void loop() {
78
+ //Continue looping until you get a complete signal received
79
+ if (myReceiver.getResults()) {
80
+ Serial.println(F("Do a cut-and-paste of the following lines into the "));
81
+ Serial.println(F("designated location in rawSend.ino"));
82
+ Serial.print(F("\n#define RAW_DATA_LEN "));
83
+ Serial.println(recvGlobal.recvLength,DEC);
84
+ Serial.print(F("uint16_t rawData[RAW_DATA_LEN]={\n\t"));
85
+ for(bufIndex_t i=1;i<recvGlobal.recvLength;i++) {
86
+ Serial.print(recvGlobal.recvBuffer[i],DEC);
87
+ Serial.print(F(", "));
88
+ if( (i % 8)==0) Serial.print(F("\n\t"));
89
+ }
90
+ Serial.println(F("1000};"));//Add arbitrary trailing space
91
+ myReceiver.enableIRIn(); //Restart receiver
92
+ }
93
+ }
22
94
 
23
95
  上記のURLに飛ぶと同じコードあります。
24
96
 

2

追加

2024/06/19 11:36

投稿

younet
younet

スコア2

test CHANGED
File without changes
test CHANGED
@@ -1,5 +1,6 @@
1
1
  ### 実現したいこと
2
- 現在groveの赤外線送信機と受信機をアルディーノを使い制御しようとています。前回の質問でgrove公式が出しているやり方でコンパイルに成功しましたが、シリアルモニタには何も表示されないです。シリアルモニタに動作している証拠が表示されるはずなのでシリアルモニタに表示されない理由と解決策を教えていただきたいです。(画像は一枚目受信機Verと二枚目送信機Ver)
2
+ 現在groveの赤外線送信機と受信機をアルディーノを使い制御しようとています。前回の質問でgrove公式が出しているやり方でコンパイルに成功しましたが、シリアルモニタには何も表示されないです。シリアルモニタに動作している証拠が表示されるはずなのでシリアルモニタに表示されない理由と解決策としてサンプルコードを教えていただきたいです。
3
+ サイトにはアルディーノ用のデモコードは提供できないと書いてあるのでアルディーノでは対応できないコードだと思います。(公式のサンプルコード画像は一枚目受信機Verと二枚目送信機Ver)
3
4
  ![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2024-06-19/a213f5f4-84ce-45cb-b5f6-5d17ad03c260.png)
4
5
  ![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2024-06-19/c6d278f7-4e72-4863-ac47-b023be739d1a.png)
5
6
 

1

追加

2024/06/19 11:30

投稿

younet
younet

スコア2

test CHANGED
File without changes
test CHANGED
@@ -12,14 +12,14 @@
12
12
  ### 発生している問題・分からないこと
13
13
  grove公式サイトではアルディーノを使っておらず、私がアルディーノと送受信機だけやろうとしているからシリアルモニタに何も表示されないのですか?
14
14
  また、アルディーノとgroveの送受信機だけを使い赤外線の送受信をしたいです。
15
+ 送受信のそれぞれのコードをまとめていないのですがそれが原因ですか?
16
+ サイト記載内容を見落としていたらすみません。
15
17
 
16
18
 
17
19
 
18
20
  ### 該当のソースコード
19
21
 
20
- ```
21
22
  上記のURLに飛ぶと同じコードあります。
22
- ```
23
23
 
24
24
  ### 試したこと・調べたこと
25
25
  - [x] teratailやGoogle等で検索した