前まではできたのですが、COM10として認識していたものが、書き込み中にCOM6と認識され書き込むことができなくなりました。リセットを使って書き込む方法もできませんでした。ボードはSparkfun Pro Microでボードマネージャーからインストールして書き込みました。もしかしたら、一度Aruduino Pro Micro3.3Vのモードで書き込んだのが原因かもしれません。
このようなログが出ました
最大28672バイトのフラッシュメモリのうち、スケッチが6868バイト(23%)を使っています。 最大2560バイトのRAMのうち、グローバル変数が292バイト(11%)を使っていて、ローカル変数で2268バイト使うことができます。 avrdude: ser_open(): can't open device "\.\COM6": 指定されたファイルが見つかりません。 マイコンボードに書き込もうとしましたが、エラーが発生しました。 このページを参考にしてください。 http://www.arduino.cc/en/Guide/Troubleshooting#upload
該当のソースコード
#include <Digitizer.h> #include <Keyboard.h> #include <Mouse.h> #define EnableMouse 7 #define Ctrl 8 #define Shift 9 const int AD = A2; const int WS = A3; const int xAxis = A1; //analog sensor for X axis const int yAxis = A0; // analog sensor for Y axis int range = 12; // output range of X or Y movement int responseDelay = 10; // response delay of the mouse, in ms int threshold = range/4; // resting threshold int center = range/2; // resting position value int minima[] = { 1023, 1023}; // actual analogRead minima for {x, y} int maxima[] = { 0,0}; // actual analogRead maxima for {x, y} int axis[] = { xAxis, yAxis}; // pin numbers for {x, y} int mouseReading[2]; // final mouse readings for {x, y} int xAD = 0; int DyWS = 0; void setup() { Keyboard.begin(); pinMode(Ctrl, INPUT_PULLUP); pinMode(Shift, INPUT_PULLUP); pinMode(EnableMouse, INPUT_PULLUP); Mouse.begin(); Serial.begin(9600); } void loop() { // read and scale the two axes: int xReading = -readAxis(0); int yReading = readAxis(1); if(digitalRead(EnableMouse) == LOW){ Digitizer.move(0,0); delay(responseDelay); } } /* reads an axis (0 or 1 for x or y) and scales the analog input range to a range from 0 to <range> */ int readAxis(int axisNumber) { int distance = 0; // distance from center of the output range // read the analog input: int reading = analogRead(axis[axisNumber]); // of the current reading exceeds the max or min for this axis, // reset the max or min: if (reading < minima[axisNumber]) { minima[axisNumber] = reading; } if (reading > maxima[axisNumber]) { maxima[axisNumber] = reading; } // map the reading from the analog input range to the output range: reading = map(reading, minima[axisNumber], maxima[axisNumber], 0, range); // if the output reading is outside from the // rest position threshold, use it: if (abs(reading - center) > threshold) { distance = (reading - center); } // the Y axis needs to be inverted in order to // map the movemment correctly: if (axisNumber == 1) { distance = -distance; } // return the distance for this axis: return distance; }
試したこと
リセットのON、OFFをコントロールして書き込むことだけではできませんでした。
ブートローダーが壊れているかもしれないので、ブートローダーの書き換え方法を教えてください。
また、そのほかに知っている方法があれば教えてください
補足情報(FW/ツールのバージョンなど)
Arduino1.8.5(WindowsStore1.8.10.0)
コンパイルエラーは出ませんでした
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/06/17 11:46
2018/06/17 16:33
2018/08/18 07:27
2018/08/18 10:15