antiblock
Cyphriun
  • Chatbox

    You don't have permission to chat.
    Load More
BabyWolf

Arduino Webclient

7 posts in this topic

Boas, maltinha.

 

Venho-vos aqui pedir ajuda numa questão pouco pertinente. Alguém tem conhecimento de programação em Arduino + Arduino Ethernet Shield?

É o seguinte, tenho uma plataforma de gestão de telemóveis dentro de sala de aula e tenho a programação dos Infravermelhos e do led RGB a trabalhar correctamente. Só tenho o problema da ligação do website com o Arduino. Uma vez que faz parte da minha PAP, gostava de obter ajuda até hoje à noite. Já estive a pesquisar e tenho um Ethernet Shield funcional. Se alguém não se importar de me ajudar, por favor, mande MP aqui.

Share this post


Link to post
Share on other sites
antiblock
diamwall

Por acaso estás a fazer isso com a net da escola? se sim não vais conseguir pois a escola tem muita coisa bloqueada.

Share this post


Link to post
Share on other sites

As bases foram renovadas, em princípio terei o website a correr do meu PC de casa c/ o No-IP. acham que é possível?

Share this post


Link to post
Share on other sites

não precisas de nada disso, o arduino cria te o site tens é q configurar aquilo bem.

Abre o arduino e vai a Exemplos > Ethernet > WebServer

No arduino alteras o ip e o mac e depois mudas o site a teu gosto 

Share this post


Link to post
Share on other sites

não precisas de nada disso, o arduino cria te o site tens é q configurar aquilo bem.

Abre o arduino e vai a Exemplos > Ethernet > WebServer

No arduino alteras o ip e o mac e depois mudas o site a teu gosto 

Tens Skype ou e-mail?

Share this post


Link to post
Share on other sites
#include <Ethernet.h>
#include <SPI.h>

byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0xFC, 0x19 };
IPAddress ip(127, 0, 0, 1);
EthernetClient client;

int IRpin = A0;
int IRemitter = 2;
int ambientIR;
int obstacleIR;
int value[10];
int distance;
int redPin = 4;
int greenPin = 8;
int bluePin = 6;

  void setup(){
    Serial.begin(9600);
    
    /*if (Ethernet.begin(mac) == 0) {
      Serial.printIn("Falhou a configuração");
      }*/
    
    pinMode(IRemitter,OUTPUT);
    digitalWrite(IRemitter,LOW);
    pinMode(redPin,OUTPUT);
    pinMode(greenPin,OUTPUT);
    pinMode(bluePin,OUTPUT);
  }

  void loop(){
    distance = readIR(5);
    /*Client.connect("http://127.0.0.1/");
    Client.println(distance);*/
    
    led();
  }

int readIR(int times){
  for(int x=0;x<times;x++){
    digitalWrite(IRemitter,LOW);
    ambientIR = analogRead(IRpin);
    digitalWrite(IRemitter,HIGH);
    delay(1);
    obstacleIR = analogRead(IRpin);
    value[x] = ambientIR-obstacleIR;
  }
  for(int x=0;x<times;x++){
    distance+=value[x];
  }
  return(distance/times);
}

void led(){
  
  if(distance>1){
    digitalWrite(redPin,HIGH);  
    digitalWrite(greenPin,LOW);
    
    //client.connect("http://localhost/controlentry.php?type=clear",80);
  }else{
    digitalWrite(redPin,LOW);  
    digitalWrite(greenPin,HIGH);
    delay(150);
    //client.connect("http://localhost/controlentry.php?type=add",80);
  }
}

Update. Podem ajudar?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now