Help!!!
!I got 6 hours to submit a project! -
I havent messd it up, but i was thinking
how will I be able to get a software slider instead of a potentionmeter? (E.g. instead of controlling somethign called sensorValue with a potentiometer and analogRead(), Would i be able to use a software slider instead?)
Im not going to make a application,
just a web interface with the arduino ethernet shield. (I would like to connect it to the android as well though wifi)
tl;dr: using a software slider
e.g - http://www.biemmeitalia.net/blog/?p=166 in the youtube video where he uses a slider for PWM? Please help! this is a vital part of my project ![]()
Thanks in advance to anyone who cares to help a noob ![]()
(Not a complete one, though
)
Jubito?
Is there any other way? Is it even possible with jubito?
wtf is jubito?
Why the hell are you proposing jubito and then asking us what it is?
There are lots of ways to achieve what you're describing.
One option is to write your user interface as a Processing application that runs on a PC with a USB connection to the Arduino.
Another is to use Firmata as the mechanism to communicate from your user interface to the Arduino. I believe there is a thin client version of Firmata although I haven't used it.
Another option is to have the Arduino host a web server which presents a web page with your user interface in, and design the web page and web server so that a slider on the page sends movement events to the Arduino e.g. using some sort of AJAX based approach.
Another option is to host the web app providing your UI on a PC and have that web app send commands to the Arduino via a web service hosted on the Arduino.
This is far from an exhaustive list. You need to identify what UI technology you're familiar with or capable or learning in the time available, and design your solution around that.
ahmedzacky:
Jubito?
Is there any other way? Is it even possible with jubito?
wtf is jubito?
I think the mistake a lot of us make is thinking the state-appointed shrink is our friend.
Web slider project.
//zoomkat 2/26/13
//SD server slider test code
//open serial monitor to see what the arduino receives
//browser address will look like http://192.168.1.102:84/servosld.htm when submited
//for use with W5100 based ethernet shields
//put the servosld.htm, slider.js, bluev_sl.gif,
//and bluev_bg.gif on the SD card
//download flies at:
// http://web.comporium.net/~shb/pix/servosld.htm
// http://web.comporium.net/~shb/pix/slider.js
// http://web.comporium.net/~shb/pix/bluev_bg.gif
// http://web.comporium.net/~shb/pix/bluev_sl.gif
//
#include <SD.h>
#include <SPI.h>
#include <Ethernet.h>
#include <Servo.h>
Servo myservoa, myservob, myservoc, myservod; // create servo object to control a servo
Servo myservoe, myservof, myservog; // myservoh not used due to lack of another free pin
String readString, pos;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // ip in lan
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(84); //server port
//////////////////////
void setup(){
Serial.begin(9600);
// disable w5100 while setting up SD
pinMode(10,OUTPUT);
digitalWrite(10,HIGH);
Serial.print("Starting SD..");
if(!SD.begin(4)) Serial.println("failed");
else Serial.println("ok");
Ethernet.begin(mac, ip, gateway, gateway, subnet);
//delay(2000);
server.begin();
Serial.println("Ready");
myservoa.attach(2); //the pin for the servoa control
myservob.attach(3); //the pin for the servob control
myservoc.attach(5); //the pin for the servoc control
myservod.attach(6); //the pin for the servod control
myservoe.attach(7); //the pin for the servoa control
myservof.attach(8); //the pin for the servob control
myservog.attach(9); //the pin for the servoc control
//myservoh.attach(10); //the pin for the servod control
}
void loop(){
// Create a client connection
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();
//read char by char HTTP request
if (readString.length() < 100) {
//store characters to string
readString += c;
//Serial.print(c);
}
//if HTTP request has ended
if (c == '\n') {
///////////////
Serial.println(readString); //print to serial monitor for debuging
//select proper header for file to be sent to browser
client.println("HTTP/1.1 200 OK"); //send new page
if(readString.indexOf("servosld") >=0) {
client.println("Content-Type: text/html");
client.println();
}
if(readString.indexOf("slider") >=0) {
client.println("Content-Type: application/x-javascript");
client.println();
}
if(readString.indexOf("bluev") >=0) {
client.println("Content-Type: image/gif");
client.println();
}
//select file to send to browser
if(readString.indexOf("servosld") >=0) {
File myFile = SD.open("SERVOSLD.HTM");
if (myFile) {
byte clientBuf[64];
int clientCount = 0;
while (myFile.available())
{
clientBuf[clientCount] = myFile.read();
clientCount++;
if(clientCount > 63)
{
client.write(clientBuf,64);
clientCount = 0;
}
}
if(clientCount > 0) client.write(clientBuf,clientCount);
myFile.close();
}
}
if(readString.indexOf("slider") >=0) {
File myFile = SD.open("slider.js");
if (myFile) {
byte clientBuf[64];
int clientCount = 0;
while (myFile.available())
{
clientBuf[clientCount] = myFile.read();
clientCount++;
if(clientCount > 63)
{
client.write(clientBuf,64);
clientCount = 0;
}
}
if(clientCount > 0) client.write(clientBuf,clientCount);
myFile.close();
}
}
if(readString.indexOf("bluev_sl") >=0) {
File myFile = SD.open("bluev_sl.gif");
if (myFile) {
byte clientBuf[64];
int clientCount = 0;
while (myFile.available())
{
clientBuf[clientCount] = myFile.read();
clientCount++;
if(clientCount > 63)
{
client.write(clientBuf,64);
clientCount = 0;
}
}
if(clientCount > 0) client.write(clientBuf,clientCount);
myFile.close();
}
}
if(readString.indexOf("bluev_bg") >=0) {
File myFile = SD.open("bluev_bg.gif");
if (myFile) {
byte clientBuf[64];
int clientCount = 0;
while (myFile.available())
{
clientBuf[clientCount] = myFile.read();
clientCount++;
if(clientCount > 63)
{
client.write(clientBuf,64);
clientCount = 0;
}
}
if(clientCount > 0) client.write(clientBuf,clientCount);
myFile.close();
}
}
delay(1);
//stopping client
client.stop();
//process GET string request from client and and position servo
pos = readString.substring(8, 12); //get the first four characters
//Serial.println(pos);
int n = pos.toInt(); //convert readString into a number
Serial.println(n);
Serial.println();
if(readString.indexOf("?0") >0) myservoa.writeMicroseconds(n);
if(readString.indexOf("?1") >0) myservob.writeMicroseconds(n);
if(readString.indexOf("?2") >0) myservoc.writeMicroseconds(n);
if(readString.indexOf("?3") >0) myservod.writeMicroseconds(n);
if(readString.indexOf("?4") >0) myservoe.writeMicroseconds(n);
if(readString.indexOf("?5") >0) myservof.writeMicroseconds(n);
if(readString.indexOf("?6") >0) myservog.writeMicroseconds(n);
//only seven servo pins, so back to myservoa for testing
if(readString.indexOf("?7") >0) myservoa.writeMicroseconds(n);
//clearing string for next read
readString="";
pos="";
}
}
}
}
}
zoomkat:
ahmedzacky:
Jubito?
Is there any other way? Is it even possible with jubito?
wtf is jubito?I think the mistake a lot of us make is thinking the state-appointed shrink is our friend.
Webslider
Thanks. I'll try using it.
PeterH:
Why the hell are you proposing jubito and then asking us what it is?There are lots of ways to achieve what you're describing.
One option is to write your user interface as a Processing application that runs on a PC with a USB connection to the Arduino.
Another is to use Firmata as the mechanism to communicate from your user interface to the Arduino. I believe there is a thin client version of Firmata although I haven't used it.
Another option is to have the Arduino host a web server which presents a web page with your user interface in, and design the web page and web server so that a slider on the page sends movement events to the Arduino e.g. using some sort of AJAX based approach.
Another option is to host the web app providing your UI on a PC and have that web app send commands to the Arduino via a web service hosted on the Arduino.
This is far from an exhaustive list. You need to identify what UI technology you're familiar with or capable or learning in the time available, and design your solution around that.
Sorry, that was a keyword in my search so i decided to get some help ![]()
Thank you for the suggestions, i'll try Firmata, or a web server with ajax ![]()
zoomkat:
ahmedzacky:
Jubito?
Is there any other way? Is it even possible with jubito?
wtf is jubito?I think the mistake a lot of us make is thinking the state-appointed shrink is our friend.
Web slider project.
//zoomkat 2/26/13
//SD server slider test code
//open serial monitor to see what the arduino receives
//browser address will look like http://192.168.1.102:84/servosld.htm when submited
//for use with W5100 based ethernet shields
//put the servosld.htm, slider.js, bluev_sl.gif,
//and bluev_bg.gif on the SD card
//download flies at:
// http://web.comporium.net/~shb/pix/servosld.htm
// http://web.comporium.net/~shb/pix/slider.js
// http://web.comporium.net/~shb/pix/bluev_bg.gif
// http://web.comporium.net/~shb/pix/bluev_sl.gif
//
#include <SD.h>
#include <SPI.h>
#include <Ethernet.h>
#include <Servo.h>
Servo myservoa, myservob, myservoc, myservod; // create servo object to control a servo
Servo myservoe, myservof, myservog; // myservoh not used due to lack of another free pin
String readString, pos;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // ip in lan
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(84); //server port
//////////////////////
void setup(){
Serial.begin(9600);
// disable w5100 while setting up SD
pinMode(10,OUTPUT);
digitalWrite(10,HIGH);
Serial.print("Starting SD..");
if(!SD.begin(4)) Serial.println("failed");
else Serial.println("ok");
Ethernet.begin(mac, ip, gateway, gateway, subnet);
//delay(2000);
server.begin();
Serial.println("Ready");
myservoa.attach(2); //the pin for the servoa control
myservob.attach(3); //the pin for the servob control
myservoc.attach(5); //the pin for the servoc control
myservod.attach(6); //the pin for the servod control
myservoe.attach(7); //the pin for the servoa control
myservof.attach(8); //the pin for the servob control
myservog.attach(9); //the pin for the servoc control
//myservoh.attach(10); //the pin for the servod control
}
void loop(){
// Create a client connection
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();
//read char by char HTTP request
if (readString.length() < 100) {
//store characters to string
readString += c;
//Serial.print(c);
}
//if HTTP request has ended
if (c == '\n') {
///////////////
Serial.println(readString); //print to serial monitor for debuging
//select proper header for file to be sent to browser
client.println("HTTP/1.1 200 OK"); //send new page
if(readString.indexOf("servosld") >=0) {
client.println("Content-Type: text/html");
client.println();
}
if(readString.indexOf("slider") >=0) {
client.println("Content-Type: application/x-javascript");
client.println();
}
if(readString.indexOf("bluev") >=0) {
client.println("Content-Type: image/gif");
client.println();
}
//select file to send to browser
if(readString.indexOf("servosld") >=0) {
File myFile = SD.open("SERVOSLD.HTM");
if (myFile) {
byte clientBuf[64];
int clientCount = 0;
while (myFile.available())
{
clientBuf[clientCount] = myFile.read();
clientCount++;
if(clientCount > 63)
{
client.write(clientBuf,64);
clientCount = 0;
}
}
if(clientCount > 0) client.write(clientBuf,clientCount);
myFile.close();
}
}
if(readString.indexOf("slider") >=0) {
File myFile = SD.open("slider.js");
if (myFile) {
byte clientBuf[64];
int clientCount = 0;
while (myFile.available())
{
clientBuf[clientCount] = myFile.read();
clientCount++;
if(clientCount > 63)
{
client.write(clientBuf,64);
clientCount = 0;
}
}
if(clientCount > 0) client.write(clientBuf,clientCount);
myFile.close();
}
}
if(readString.indexOf("bluev_sl") >=0) {
File myFile = SD.open("bluev_sl.gif");
if (myFile) {
byte clientBuf[64];
int clientCount = 0;
while (myFile.available())
{
clientBuf[clientCount] = myFile.read();
clientCount++;
if(clientCount > 63)
{
client.write(clientBuf,64);
clientCount = 0;
}
}
if(clientCount > 0) client.write(clientBuf,clientCount);
myFile.close();
}
}
if(readString.indexOf("bluev_bg") >=0) {
File myFile = SD.open("bluev_bg.gif");
if (myFile) {
byte clientBuf[64];
int clientCount = 0;
while (myFile.available())
{
clientBuf[clientCount] = myFile.read();
clientCount++;
if(clientCount > 63)
{
client.write(clientBuf,64);
clientCount = 0;
}
}
if(clientCount > 0) client.write(clientBuf,clientCount);
myFile.close();
}
}
delay(1);
//stopping client
client.stop();
//process GET string request from client and and position servo
pos = readString.substring(8, 12); //get the first four characters
//Serial.println(pos);
int n = pos.toInt(); //convert readString into a number
Serial.println(n);
Serial.println();
if(readString.indexOf("?0") >0) myservoa.writeMicroseconds(n);
if(readString.indexOf("?1") >0) myservob.writeMicroseconds(n);
if(readString.indexOf("?2") >0) myservoc.writeMicroseconds(n);
if(readString.indexOf("?3") >0) myservod.writeMicroseconds(n);
if(readString.indexOf("?4") >0) myservoe.writeMicroseconds(n);
if(readString.indexOf("?5") >0) myservof.writeMicroseconds(n);
if(readString.indexOf("?6") >0) myservog.writeMicroseconds(n);
//only seven servo pins, so back to myservoa for testing
if(readString.indexOf("?7") >0) myservoa.writeMicroseconds(n);
//clearing string for next read
readString="";
pos="";
}
}
}
}
}
Hey zoom, I tried your webpage, but I get nothing but a blank page. Why? What can I do?
Hey zoom, I tried your webpage, but I get nothing but a blank page. Why? What can I do?
Not sure what your problem is, but note that the files used in the code I posted are served from an SD disk on the arduino Ethernet shield, and the link provided in the code info section has the Ethernet shield using a LAN IP address and port 84, 192.168.1.102:84 Below is the same basic slider page served from my ISP's web server.
zoomkat:
Hey zoom, I tried your webpage, but I get nothing but a blank page. Why? What can I do?
Not sure what your problem is, but note that the files used in the code I posted are served from an SD disk on the arduino Ethernet shield, and the link provided in the code info section has the Ethernet shield using a LAN IP address and port 84, 192.168.1.102:84 Below is the same basic slider page served from my ISP's web server.
Yes, I dwnloaded the files and put them on the sd card. still not working
Yes, I dwnloaded the files and put them on the sd card. still not working
Perhaps you should post your code.