Bonjour,
J'ai donc réalisé la premiére partie grâce à ton code.
Cela fonctionne très bien je n'ai plus d'incrementation de fichiers
Pour la deuxieme partie j'ai essayé avec "64" et cela ne fonctionne pas, tant pis pour la vitesse.
Maintenant je rencontre un problème en voulant fusionner deux programmes: celui de la camera, et un programme de serveur ethernet ( celui-ci crée une page HTML et grace a un bouton on active ou non un servo moteur).
Separement les deux codes fonctionnent, et lors de la fusion, rien ne se passe comme on le souhaite.
je vous met le code ethernet ![]()
#include <SPI.h>
#include <Ethernet.h>
#include <Servo.h>
Servo microservo;
int pos = 0;
int fsrAnalogPin2 = A1;
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0E, 0xA6, 0x0D }; //physical mac address
byte ip[] = { 169, 254, 73, 50 }; // ip in lan (that's what you need to use in your browser. ("192.168.1.178")
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port
String readString;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
microservo.attach(9);
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}
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
client.println("HTTP/1.1 200 OK"); //send new page
client.println("Content-Type: text/html");
client.println();
client.println("<HTML>");
client.println("<HEAD>");
client.println("<meta name='apple-mobile-web-app-capable' content='yes' />");
client.println("<meta name='apple-mobile-web-app-status-bar-style' content='black-translucent' />");
client.println("<link rel='stylesheet' type='text/css' href='http://randomnerdtutorials.com/ethernetcss.css' />");
client.println("<TITLE>AUTOBARRIGO</TITLE>");
client.println("</HEAD>");
client.println("<BODY>");
client.println("<H1>Autobarrigo : simulation de passage</H1>");
client.println("<hr />");
client.println("
");
client.println("
");
client.println("
");
client.println("<a href=\"/03312203011191tmm\"\">Ouverture</a>");
client.println("
");
client.println("</BODY>");
client.println("</HTML>");
delay(1000);
//stopping client
client.stop();
//controls the Arduino if you press the buttons
if (readString.indexOf("03312203011191tmm") >0){
for(pos = 53; pos < 143; pos += 5) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
microservo.write(pos); // tell servo to go to position in variable 'pos'
delay(100); // waits 15ms for the servo to reach the position
}
}
//clearing string for next read
readString="";
}
}
}
}
if (analogRead(fsrAnalogPin2) > 400)
{
for(pos = 143; pos>=53; pos-=5) // goes from 180 degrees to 0 degrees
{
microservo.write(pos); // tell servo to go to position in variable 'pos'
delay(100); // waits 15ms for the servo to reach the position
}
}
}