system
November 16, 2014, 6:09pm
1
Hi,
i seem to have an error.
can someone help me?
running arduino uno
code:
#include <WiFi.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
char ssid[] = "WebCube42-AC55";
char pass[] = "B4F59852";
int status = WL_IDLE_STATUS;
void setup() {
Serial.begin(9600);
while (!Serial) {
;
}
if (WiFi.status() == WL_NO_SHIELD) {
void setup ();{
lcd.begin(16, 2);
lcd.print("WiFi shield not present");
delay(1000);
while(true);
}
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
lcd.print(ssid);
status = WiFi.begin(ssid, pass);
}
lcd.print("You're connected to the network");
}
void printWifiData(); {
IPAddress ip = WiFi.localIP();
lcd.print("IP Address: ");
lcd.println(ip);
}
}
error:
core.a(main.cpp.o): In function main': /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/main.cpp:14: undefined reference to loop'
Where is the loop() function? All the sketches must have one loop() function.
system
November 16, 2014, 6:18pm
3
hi luisilva,
where do i put the loop() function?
To be completely honest with you, I don't understand very well you code, but for what I understand, I will do:
#include <WiFi.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
char ssid[] = "WebCube42-AC55";
char pass[] = "B4F59852";
int status = WL_IDLE_STATUS;
void setup() {
lcd.begin(16, 2);
Serial.begin(9600);
while (!Serial) {
;
}
}
void loop() {
if (WiFi.status() == WL_NO_SHIELD) {
lcd.print("WiFi shield not present");
delay(1000);
while(true);
}
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
lcd.print(ssid);
status = WiFi.begin(ssid, pass);
}
lcd.print("You're connected to the network");
}
void printWifiData() {
IPAddress ip = WiFi.localIP();
lcd.print("IP Address: ");
lcd.println(ip);
}
or:
#include <WiFi.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
char ssid[] = "WebCube42-AC55";
char pass[] = "B4F59852";
int status = WL_IDLE_STATUS;
void setup() {
lcd.begin(16, 2);
Serial.begin(9600);
}
void loop() {
while (!Serial) {
;
}
if (WiFi.status() == WL_NO_SHIELD) {
lcd.print("WiFi shield not present");
delay(1000);
while(true);
}
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
lcd.print(ssid);
status = WiFi.begin(ssid, pass);
}
lcd.print("You're connected to the network");
}
void printWifiData() {
IPAddress ip = WiFi.localIP();
lcd.print("IP Address: ");
lcd.println(ip);
}
or:
#include <WiFi.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
char ssid[] = "WebCube42-AC55";
char pass[] = "B4F59852";
int status = WL_IDLE_STATUS;
void setup() {
lcd.begin(16, 2);
Serial.begin(9600);
while (!Serial) {
;
}
if (WiFi.status() == WL_NO_SHIELD) {
lcd.print("WiFi shield not present");
delay(1000);
while(true);
}
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
lcd.print(ssid);
status = WiFi.begin(ssid, pass);
}
lcd.print("You're connected to the network");
}
void loop() {
}
void printWifiData() {
IPAddress ip = WiFi.localIP();
lcd.print("IP Address: ");
lcd.println(ip);
}