Hello,
To learn how to work with the Arduino yun I found an earlier post from "tcmspark"
http://forum.arduino.cc/index.php?topic=263988.0
I slightly modified the sketch.(see under).
On pin 13,12,11 I placed LED's to confirm the program works when I push a button.
I Copied the Arduino sketch in mydocuments/Arduino/test.ino
I Copied the HTML file to mydocuments/Arduino/WWW/index.html
I copied the file jsHere.js mydocuments/Arduino/www/js/jsHere.js
I copied the file zepto.min.js mydocuments/Arduino/www/js/zepto.min.js
So,
The first problem I found is that the files in the WWW directory aren't send to the sd Card by uploading the sketch.
The sd card has already an Arduino/WWW directory on it, and Arduino IDE says there aren't problems with finding an directory such as sd/www/
I also tried another tutorial (babaawesome control input output using ajax)and it uploads the contents of the WWW folder correctly.
So after this i put the files myself on the sd card.
After that i can open the site with the pushbuttons but the leds aren't going to blink ![]()
REST API is set to OPEN.
Whats wrong and/or missing and/or?
![]()
Kind regards,
Harmen
ARDUINO SKETCH
#include <Bridge.h>
#include <YunServer.h>
#include <YunClient.h>
YunServer server;
String readString;
void setup() {
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
Bridge.begin();
//digitalWrite(13, HIGH);
server.listenOnLocalhost();
server.begin();
}
void loop() {
YunClient client = server.accept();
if (client) {
String command = client.readString();
command.trim(); //kill whitespace
Serial.println(command);
if (command == "rolloutcarpet") {
digitalWrite(11, HIGH);
delay(1000);
digitalWrite(11, LOW);
delay(1000);
digitalWrite(11, HIGH);
delay(1000);
digitalWrite(11, LOW);
delay(1000);
}
if (command == "playfanfare") {
digitalWrite(12, HIGH);
delay(1000);
digitalWrite(12, LOW);
delay(1000);
digitalWrite(12, HIGH);
delay(1000);
digitalWrite(12, LOW);
delay(1000);
}
if (command == "stopfanfare") {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
client.stop();
}
delay(50);
}
HTML CODE (ORIGINAL)
Roll Out the Carpet LED BLUE OFFPLAY FANFARE
STOP FANFARE