如何在Arduino中修复NullPointerException?

时间:2016-07-11 07:04:54

标签: arduino arduino-ide

我想在windows中的Arduino IDE中运行此代码。此代码是一个简单的测试代码:

void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
 }

 // the loop function runs over and over again forever
 void loop() {
   digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
   delay(1000);              // wait for a second
   digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
   delay(1000);              // wait for a second
 }

但是当我尝试运行它时,我收到此错误:

java.lang.NullPointerException
    at cc.arduino.packages.uploaders.SerialUploader.uploadUsingProgrammer(SerialUploade    r.java:316)
    at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUpload    er.java:91)
    at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78)
    at processing.app.Sketch.upload(Sketch.java:1186)
    at processing.app.Sketch.exportApplet(Sketch.java:1160)
    at processing.app.Sketch.exportApplet(Sketch.java:1132)
    at processing.app.Editor$DefaultExportAppHandler.run(Editor.java:2506)
    at java.lang.Thread.run(Thread.java:745)

哪里错了?

0 个答案:

没有答案