我刚用Grove Starter Kit Plus买了一个Intel Edison Breakout Board Kit。我想写一个程序,给板一个IP地址,检查房间里的温度,如果超过这个温度,就会打开LED。我可以用RGB显示器检查发生了什么。当我将USB OTG端口连接到笔记本电脑时,wifi连接被完美检测到,IP地址被完美接收,温度控制工作正常。这个程序按我的要求运行。现在是问题。我想在拔下USB连接的情况下执行相同的程序,所以我想让这个板独立于PC,就像它是一个独立的设备一样
1)如果我在板中上传这个工作程序,拔下USB插头,当然只通过转接板上的插孔提供电源,它就不再工作了,并在消息"准备网络连接…"时停止。但英特尔爱迪生有一个集成的wifi模块,我真的不明白为什么没有USB与我的笔记本电脑的连接,它就无法再建立互联网连接。它怎么了?如何使用电源启动和执行此程序?这是我的程序的设置函数(),我们没有到达loop(),所以我不会发布它
void setup()
{
// ------ LCD IN ACTION ------ //
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// setting the color for the connection
lcd.setRGB(colorR, colorG, colorB);
lcd.print("preparing network connection...");
// scroll 40 positions (string length) to the left
// to move it offscreen left:
for (int positionCounter = 0; positionCounter < 40; positionCounter++)
{
// scroll one position left:
lcd.scrollDisplayLeft();
// wait a bit:
delay(350);
}
// ------ SERIAL CONNECTION ------ //
// opening the serial connection
// Serial.begin(9600); // initialize serial communication
// ------ SETTING I/O PINS ------ //
pinMode(potentiometer, INPUT); // angle sensor's pin for input.
pinMode(12, OUTPUT); // set the blue LED pin mode
pinMode(13, OUTPUT); // set the red LED pin mode
pinMode(pinLed, OUTPUT); // set the green LED pin mode
// ------ WIFI CONNECTION CONTROLS ------ //
// check for the presence of the wifi shield:
if (WiFi.status() == WL_NO_SHIELD)
{
// Serial.println("WiFi shield not present");
while(true); // don't continue
}
// check firmware version
String fv = WiFi.firmwareVersion();
// if( fv != "1.1.0" )
// Serial.println("Please upgrade the firmware");
// ------ WIFI CONNECTION ------ //
// attempt to connect to Wifi network:
while (status != WL_CONNECTED)
{
// Serial.print("Attempting to connect to Network named: ");
// Serial.println(ssid); // print the network name (SSID);
// connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
// wait 3 seconds for connection:
delay(3000);
}
server.begin(); // start the web server on port 70
printWifiStatus();
其中
void printWifiStatus() {
// print the SSID of the network you're attached to:
// Serial.print("SSID: ");
// Serial.println(WiFi.SSID());
colorR = 255;
colorG = 180;
colorB = 0;
lcd.clear();
lcd.setRGB(colorR, colorG, colorB);
lcd.print(WiFi.SSID());
delay(3000);
// print your WiFi shield's IP address:
IPAddress ip = WiFi.localIP();
// Serial.print("IP Address: ");
// Serial.println(ip);
colorR = 0;
colorG = 255;
colorB = 0;
lcd.setCursor(0, 1);
lcd.setRGB(colorR, colorG, colorB);
lcd.print(ip);
delay(3000);
/*
delay(5000);
colorR = 180;
colorG = 255;
colorB = 255;
lcd.setRGB(colorR, colorG, colorB);
lcd.noDisplay();
*/
// print the received signal strength:
long rssi = WiFi.RSSI();
// Serial.print("signal strength (RSSI):");
// Serial.print(rssi);
// Serial.println(" dBm");
// print where to go in a browser:
// Serial.print("To see this page in action, open a browser to http://");
// Serial.println(ip);
}
2)总是关于预加载程序的执行:如果我加载ArduinoIDE的默认闪烁程序,拔下USB并给电源,它就可以完美工作[这是正确的自启动,是的],但如果我用Serial.begin()和Serial.print("Arduino闪烁")上传相同的程序,如果没有USB连接到我的笔记本电脑,它就无法再工作[这就是我之前评论Serial的原因]。是因为电路板非常智能,可以检测到在第一种情况下串行连接并没有真正发生吗?
3)关于程序存储的最后一个问题:当我用arduino IDE编译程序时,它会给我与程序可用内存相关的已用内存百分比
Sketch is using 103.266 byte (1%) of program memory. The limit is 10.000.000 byte
但是Intel Edison有4GB eMMC,那么为什么只有10MB可用于程序呢?程序是在哪个内存中上传的?
提前感谢那些将尝试帮助的人
你知道我该如何检查它存储在哪里吗?
您可以在串行通信终端上检查您的文件。如果你的文件可能在目录中,你可以使用linux命令,比如:
cd directory
和ls
或者,如果你知道文件名,你甚至可以"搜索"文件。您可能需要查看此网站。
或者您可以使用SCP、FTP客户端程序(如WinSCP)查看Edison上的文件。
如果我在板中上传此工作程序
您确定您的程序已闪存到持久内存中吗?我不认识这块木板。在大多数情况下,当你的程序只传输到RAM内存,而没有存储在Flash中时,就会出现这种问题。
Sketch正在使用103.266字节(1%)的程序内存。限制是10.000.000字节
10MB RAM还是闪存?
据我所知,你用的是Arduino+Edison?
10MB限制对应哪个板?Sketch使用的是103.266字节:是RAM还是Flash?
尝试通过putty 键入这些命令
ifconfig usb0 down
ifconfig wlan0 down
ifconfig usb0 up
ifconfig wlan0 up
可能做到