Show Posts
Pages: [1] 2 3 ... 11
1  International / Portugues / Re: Arduino no Jornal Nacional on: July 23, 2014, 08:42:16 am
Obrigado por compartilhar.

Não assisti neste dia.
2  International / Portugues / Re: Manipulação de portas on: July 22, 2014, 11:31:11 am
Olá!

Veja se isto ajuda:

https://spreadsheets.google.com/spreadsheet/pub?key=0AtfNMvfWhA_ccnRId19SNmVWTDE0MEtTOV9HOEdQa0E&gid=0

Abraço.
Fernando Garcia
3  International / Portugues / Re: Rtc Ds1307+ Botão de Pressão on: July 22, 2014, 11:19:47 am
Olá!

Eu tenho algumas perguntas.

Porque está usando tantos pinos do arduino para fazer a mesma coisa?

Onde é que acrescenta uma hora extra após pressionar o botão?

Eu acredito que se o circuito estiver correto esse código deve funcionar.
O que pode ocorrer é que a mudança de estado do pino é tão rápida que não consegue ver o que foi impresso.

Experimente pressionar o botão durante vários segundos.


Colocando o código aqui fica mais fácil de receber ajuda.

Code:
#include "Wire.h"
#define DS1307_ADDRESS 0x68
int botao = 53;
int flag = 0;
void setup(){
  pinMode(botao, INPUT); //Seta o pino como botao como entrada
  //digitalWrite(botao, HIGH); /Foi este que abir abocado,
  Wire.begin();
  Serial.begin(9600);
  //fixos
  pinMode(22, OUTPUT);
  pinMode(23, OUTPUT); // Este ??ya
  pinMode(24, OUTPUT);
  //em horario
  pinMode(25, OUTPUT);
  pinMode(26, OUTPUT);
  pinMode(27, OUTPUT);
  pinMode(28, OUTPUT);
  pinMode(29, OUTPUT);
  pinMode(30, OUTPUT);
  pinMode(31, OUTPUT);
  pinMode(32, OUTPUT);
  pinMode(33, OUTPUT);
  pinMode(34, OUTPUT);
  pinMode(35, OUTPUT);
  pinMode(36, OUTPUT);
  pinMode(37, OUTPUT);
  pinMode(38, OUTPUT);
  pinMode(39, OUTPUT);
  pinMode(40, OUTPUT);
  pinMode(41, OUTPUT);
  pinMode(42, OUTPUT);
}

void loop(){
  digitalWrite(22, HIGH);
  digitalWrite(23, HIGH);
  digitalWrite(24, HIGH);
  printDate();
  delay(1000);
}

byte bcdToDec(byte val)  {
  // Convert binary coded decimal to normal decimal numbers
  return ( (val/16*10) + (val%16) );
}
void printDate(){

  // Reset the register pointer
  Wire.beginTransmission(DS1307_ADDRESS);

  byte zero = 0x00;
  Wire.write(zero);
  Wire.endTransmission();

  Wire.requestFrom(DS1307_ADDRESS, 7);

  int second = bcdToDec(Wire.read());
  int minute = bcdToDec(Wire.read());
  int hora = bcdToDec(Wire.read() & 0b111111); //24 hour time
  int weekDay = bcdToDec(Wire.read()); //0-6 -> sunday - Saturday
  int monthDay = bcdToDec(Wire.read());
  int month = bcdToDec(Wire.read());
  int year = bcdToDec(Wire.read());
  Serial.println("hora");
  Serial.println(hora);
  Serial.println("dia semana");
  Serial.println(weekDay);
  if(weekDay==1 || weekDay==7){
    Serial.println("OFF - Sabado / Domingo");
    digitalWrite(25, LOW);
    digitalWrite(26, LOW);
    digitalWrite(27, LOW);
    digitalWrite(28, LOW);
    digitalWrite(29, LOW);
    digitalWrite(30, LOW);
    digitalWrite(31, LOW);
    digitalWrite(32, LOW);
    digitalWrite(33, LOW);
    digitalWrite(34, LOW);
    digitalWrite(35, LOW);
    digitalWrite(36, LOW);
    digitalWrite(37, LOW);
    digitalWrite(38, LOW);
    digitalWrite(39, LOW);
    digitalWrite(40, LOW);
    digitalWrite(41, LOW);
    digitalWrite(42, LOW);
  }
  else{
    if(hora>=6 && hora<21){
      Serial.println("ON - hora");
      digitalWrite(25, HIGH);
      digitalWrite(26, HIGH);
      digitalWrite(27, HIGH);
      digitalWrite(28, HIGH);
      digitalWrite(29, HIGH);
      digitalWrite(30, HIGH);
      digitalWrite(31, HIGH);
      digitalWrite(32, HIGH);
      digitalWrite(33, HIGH);
      digitalWrite(34, HIGH);
      digitalWrite(35, HIGH);
      digitalWrite(36, HIGH);
      digitalWrite(37, HIGH);
      digitalWrite(38, HIGH);
      digitalWrite(39, HIGH);
      digitalWrite(40, HIGH);
      digitalWrite(41, HIGH); // asdasdsdlksdnn
      digitalWrite(42, HIGH);
    }
    if(hora>=21 || hora>=0 && hora<6){
      if(digitalRead(botao) == LOW){    // asdasdsdlksdnn
        Serial.println("ON - Botao");        // asdasdsdlksdnn
        digitalWrite(25, HIGH);            // asdasdsdlksdnn
        digitalWrite(26, HIGH);            // asdasdsdlksdnn               
        digitalWrite(27, HIGH);           // asdasdsdlksdnn
        digitalWrite(28, HIGH);           // asdasdsdlksdnn
        digitalWrite(29, HIGH);           // asdasdsdlksdnn
        digitalWrite(30, HIGH);           // asdasdsdlksdnn
        digitalWrite(31, HIGH);           // asdasdsdlksdnn
        digitalWrite(32, HIGH);           // asdasdsdlksdnn
        digitalWrite(33, HIGH);           // asdasdsdlksdnn
        digitalWrite(34, HIGH);           // asdasdsdlksdnn
        digitalWrite(35, HIGH);           // asdasdsdlksdnn
        digitalWrite(36, HIGH);           // asdasdsdlksdnn
        digitalWrite(37, HIGH);           // asdasdsdlksdnn
        digitalWrite(38, HIGH);           // asdasdsdlksdnn
        digitalWrite(39, HIGH);           // asdasdsdlksdnn
        digitalWrite(40, HIGH);           // asdasdsdlksdnn
        digitalWrite(41, HIGH);           // asdasdsdlksdnn
        digitalWrite(42, HIGH);            // asdasdsdlksdnn
      }
      else{
        Serial.println("OFF - hora");
        digitalWrite(25, LOW);
        digitalWrite(26, LOW);
        digitalWrite(27, LOW);
        digitalWrite(28, LOW);
        digitalWrite(29, LOW);
        digitalWrite(30, LOW);
        digitalWrite(31, LOW);
        digitalWrite(32, LOW);
        digitalWrite(33, LOW);
        digitalWrite(34, LOW);
        digitalWrite(35, LOW);
        digitalWrite(36, LOW);
        digitalWrite(37, LOW);
        digitalWrite(38, LOW);
        digitalWrite(39, LOW);
        digitalWrite(40, LOW);
        digitalWrite(41, LOW);
        digitalWrite(42, LOW);
      }
    }
  }
}


Abraço.
Fernando Garcia
4  International / Portugues / Re: PWM com frequência de 15 Hz on: July 22, 2014, 11:05:12 am
Olá!

Dê uma olhada nestes links.

http://sobisource.com/arduino-mega-pwm-pin-and-frequency-timer-control/

http://forum.arduino.cc/index.php?topic=72092.0

Abraço.
Fernando Garcia
5  International / Portugues / Re: Criar uma Rede RF entre arduinos... on: July 15, 2014, 03:14:35 pm
É uma mensagem subliminar.  smiley-zipper
6  Using Arduino / Networking, Protocols, and Devices / Re: RFM12B and arduino mega on: July 14, 2014, 10:50:04 am
Any suggestion?
7  Development / Other Hardware Development / Re: Ferduino Mega 2560 on: July 12, 2014, 02:18:17 pm
Hi!

Thanks by comment!

I spent approximately 6 months.

I'm a civil engineer, this is my first electronic project.

Was done to join many circuits necessary to my aquarium controller.

The I/O and additional circuits are basically:

9 Jack phone 3.5 mm (6 are connected in analog pins and has pull up resistor of 10K and LEDs in parallel to be used with float switches, 3 are connected to a digital pin and has a resistor pull up of 4.7K Ohm  to be used with temperature sensors in parasite mode);

2 Jack RJ45 (1 connected in an ULN2003 that’s controlled by analog pins, this circuit allow control devices untill 50V / 500mA, 1 connected to 3 analog pins and 4 digital pins);

1 Header 2 x 20 connected to hex buffers that allow connect TFT’s of 3.3V directly;

1 Connector DB37 in parallel with the header 2 x 20 that allow connect TFT’s of 3.3V using a serial cable;

2 Jack RJ11 (1 connected to digital pins, GND and 5V);

1 LAN;

1 Connector DB25 (connected to 2 ULN2803 controlled by an expander I2C);

4 Connector BNC (connected to 4 sockets to be used with circuits from Atlas Scientific);

Real Time Clock (with battery holder and jumpers to select the pins ’20, 21 or 18, 19′);

Ethernet controller (w5100);

Expander I2C  with 16 I/O pins (PCF8575);

Multiplexer for 4 devices UART (74HC4052);

Buzzer for alarm (with trimpot to adjust of volume and jumper to disable);

Hex buffers for translation of voltage in logic level (for TFT touch);

Wireless Transceiver of 915MHz (RFM12B).


Best regards.

Fernando Garcia
8  Development / Other Hardware Development / Ferduino Mega 2560 on: July 11, 2014, 01:10:49 pm
Hi!

Visit my site and see my new board dedicated to an aquarium controller but, that can be used to other projects respecting the pinout.






www.ferduino.com

Best regards.

Fernando Garcia
9  International / Portugues / Re: Módulo com 16 relés on: July 08, 2014, 11:56:44 am
Olá!

Sua dúvida está mal colocada.

Que eu saiba é só enviar um sinal HIGH ou LOW para cada INx.

Neste caso irá gastar 16 pinos do seu arduino mas, para resolver este problema pode usar um multiplexador (pcf8575 por exemplo).

Abraço.

Fernando Garcia
10  International / Portugues / Re: arduino mega 2560->contagem regressiva de tempo on: July 08, 2014, 11:48:41 am
Olá!

Eu não entendi muito bem sua pergunta mas, se quer que a contagem seja executada apenas uma vez.
Mova as funções para o setup ou crie uma condição adicional.

Substitua:

Code:
  while(1){

Por:

Code:
  if(executar == true){
executar = false;

Adicione isto no começo do programa (variável global).

Code:
boolean executar = true;

Abraço.

Fernando Garcia
11  Using Arduino / Networking, Protocols, and Devices / Re: RFM12B and arduino mega on: July 08, 2014, 09:58:22 am
Hi!

I have problem to make my arduino mega work with RFM12B.

Exist a way simple to know if the arduino is talking  with the RFM12B?

Thanks in advance!

Fernando Garcia
12  International / Portugues / Re: Ajuda: Erro:"expected unqualified-id before '{' token" on: July 07, 2014, 10:15:17 am
Olá!

Qual é a razão para colocar as variáveis entre chaves?

Code:
{
  int val = 0;
}

Abraço.

Fernando Garcia
13  Using Arduino / Programming Questions / Re: ITDB32WD and SdFat.h on: July 06, 2014, 02:20:17 pm

Which does something. Are we supposed to guess what it does, as well as what the problem is?

You are very rude !!!
14  Using Arduino / Programming Questions / Re: ITDB32WD and SdFat.h on: July 06, 2014, 02:13:10 pm
Solved only changing on void setup():

Code:
card.init(SPI_FULL_SPEED, ChipSelect_SD);

To:

Code:
card.init(SPI_HALF_SPEED, ChipSelect_SD);

 smiley-grin

Thanks !
15  Using Arduino / Programming Questions / ITDB32WD and SdFat.h on: July 06, 2014, 01:48:29 pm
Hi!

Please, someone are using the SD card on TFT with the library SdFat.h?

I need only write a .TXT.

I think that haven't problem in my code because it works with the ITDB32S.

Anyway here's my code:

Code:
#include <SdFat.h>

const int chipSelect = 5;

Sd2Card card;
SdFile file;
SdFile root;
SdVolume volume;

float temp;
float tempe;

void setup()
{
  int16_t n;
  char buf[8];

  Serial.begin(9600);
  pinMode(53,OUTPUT);
  pinMode(69,OUTPUT);
  digitalWrite(53,HIGH);
  digitalWrite(69,HIGH);
  
  card.init(SPI_FULL_SPEED,chipSelect);
  volume.init(&card);
  root.openRoot(&volume);

  while(!Serial)
  {
    ; // wait for serial.
  }

  if(file.open(&root, "LOGTDIA.TXT", O_CREAT | O_APPEND | O_WRITE))
  {
    Serial.println("Writing...");
    Serial.println();

    for(temp=27.5; temp>22.0; temp-=0.15)
    {
      file.print(temp);
      file.write((uint8_t*)"\0", 1);
      file.write((uint8_t*)"\r\n", 2);
    }

    for(tempe=22.5; tempe<28.0; tempe+=0.15)
    {
      file.print(tempe);
      file.write((uint8_t*)"\0", 1);
      file.write((uint8_t*)"\r\n", 2);
    }
    file.close();
    Serial.println("Done!");
    Serial.println();
  }
  else
  {
    Serial.println("Can't open.");
  }

  if(file.open(&root, "LOGTDIA.TXT", O_READ))
  {
    Serial.println("Reading...");
    Serial.println();
    delay(5000);
    while ((n = file.read(buf, sizeof(buf))) > 0)
    {
      Serial.println(buf);
    }
    file.close();
    Serial.println();
    Serial.print("Finished!");
  }
}
void loop()
{
}

The ITDB32WD works fine using tinyFAT.h.

Here an image using tinyFAT.h:



Thanks in advance.

Fernando Garcia
Pages: [1] 2 3 ... 11