Show Posts
Pages: 1 [2] 3 4
16  Using Arduino / Programming Questions / Re: weird comparison on: June 17, 2013, 03:53:23 pm
Thanx all
17  Using Arduino / Audio / Re: wtv020-20s schematic on: June 17, 2013, 03:40:58 pm
the name of module is [ Arduino Wave Module V2 ]
http://www.elechouse.com/elechouse/index.php?main_page=product_info&cPath=168_170&products_id=2161&zenid=knps0v5d8a7rb4cvke7thalf76

and this is datasheet for the module :
https://www.dropbox.com/s/emjehbo2xigqd5n/Arduino%20Wave%20manual.pdf
18  Using Arduino / Audio / wtv020-20s schematic on: June 17, 2013, 10:57:19 am
Hello , I saw arduino wave module  on website www.elechouse .com
Then I read datasheet of this module, the datasheet contains schematic of this module.
I want buy the pieces of this module and connect them on breadboard.

but the problem in the code  of this module :
they declare RST = 3 but in the schematic the RESEST connect with D5
and declare CLK(pin 2) = 9;DAT(pin 3) = 8; but in the schematic connect DAT(pin 2)  with A4 and CLK(pin 3) with A5
and another question what is the benefit of connect D6 with pin4(BUSY)?


 


Code:
/*
This code is show how Arduino Wave Module works with Arduino.
Code is not optimized. Any improving work on it is encouraged.
 (C) Copyright 2011 elechouse.com
 */
 
int RST = 3;
int CLK = 9;
int DAT = 8;
   
   
void setup() {   
   
   
    pinMode(RST, OUTPUT);
    pinMode(CLK, OUTPUT);
    pinMode(DAT, OUTPUT);
   
   
    digitalWrite(RST, HIGH);
    digitalWrite(CLK, HIGH);
    digitalWrite(DAT, HIGH);
   
    digitalWrite(RST, LOW);
    delay(5);
    digitalWrite(RST, HIGH);
    delay(300);
}

void loop() {
 
  send(0x0000);//play file 0000
  delay(10000);//delay 10 seconds
 
  send(0x0001);//play file 0001
  delay(10000);//delay 10 seconds
 
  send(0x0002);//play file 0002
  delay(10000);//delay 10 seconds
 
  send(0xfff0);//set voice volumn to 0 (turn off)
  delay(3000);
 
  send(0xfff4);//set voice volumn to 4
  delay(3000);
 
  send(0xfff7);//set voice volumn to 7
  delay(3000);
 
  send(0xfffe);// pause
  delay(5000);
  send(0xfffe);//play
 
 
 
  while(1);
}

/****************************************************
The following function is used to send command to wave shield.
You don't have to change it.

Send the file name to play the audio.
If you need to play file 0005.AD4, write code: send(0x0005).
For more command code, please refer to the manual
*****************************************************/
void send(int data)
{
  digitalWrite(CLK, LOW);
  delay(2);
  for (int i=15; i>=0; i--)
  {
    delayMicroseconds(50);
    if((data>>i)&0x0001 >0)
      {
        digitalWrite(DAT, HIGH);
        //Serial.print(1);
      }
    else
       {
         digitalWrite(DAT, LOW);
        // Serial.print(0);
       }
    delayMicroseconds(50);
    digitalWrite(CLK, HIGH);
    delayMicroseconds(50);
   
    if(i>0)
    digitalWrite(DAT, LOW);
    else
    digitalWrite(DAT, HIGH);
    delayMicroseconds(50);
   
    if(i>0)
    digitalWrite(CLK, LOW);
    else
    digitalWrite(CLK, HIGH);
  }
 
  delay(20);
}
19  Using Arduino / Programming Questions / weird comparison on: June 17, 2013, 10:50:27 am
is this statment [  if((data>>i) & 0x0001 >0)  ] same as [ if((data>i) && 0x0001 >0) ] ?
20  Using Arduino / Displays / Re: 3.2 TFT screen flashing on: June 17, 2013, 09:30:50 am
try to change the color of font
21  Using Arduino / Displays / Re: UTFT - dispBitmap function on: June 17, 2013, 09:19:51 am
if you use sd-card on tft-lcd,you will need to 4 libraries:
1-tinyFAT
2-UTFT
3-UTFT_tinyFAT
4-UTouch

you can download them from
http://henningkarlsen.com/electronics/library.php

the code will change to
#include <tinyFAT.h>
#include <UTFT.h>
#include <UTFT_tinyFAT.h>
#include <UTouch.h>

UTFTtf    myGLCD(ITDB32S,38,39,40,41);
UTouch  myTouch(6,5,4,3,2);

void setup(){
myGLCD.InitLCD(PORTRAIT);
myTouch.InitTouch(PORTRAIT);
file.initFAT();
myTouch.setPrecision(PREC_HI);}
22  Using Arduino / Interfacing w/ Software on the Computer / problem with serial communication arduino on: April 28, 2013, 06:25:27 pm
I wrote code to connect arduino with pic , I don't want to explain things don't matter, but the main problem is that arduino always receives data although I don't connect any wire to pins(TX3,RX3).
this simple example , I uploaded it to arduino,  and the result is that on terminal monitor
 always print "the fire in the room : " .
and sometimes print stranger characters or nothing as shown image in down .
Code:
char ch;
int index=0;
char i[4];
void setup()
{
Serial.begin(9600);
Serial3.begin(9600);
Serial.println("power on");
}

void loop()
{
  while(Serial3.available()>0)
  {
     ch=(char)Serial3.read();
     i[index]=ch;
     index++;
     if (index==3)
 {     index=0;
       Serial.println("\n");
       Serial.println("the fire in the room : ");
       Serial.print(i[0]);Serial.print(i[1]);Serial.print(i[2]);  }
  }
}

23  Using Arduino / Interfacing w/ Software on the Computer / Re: problem with serial communication arduino - pic on: April 19, 2013, 06:16:17 am
So, what the hell does r() do?
the function r()to read serial msg(the number of room) from pic16f88 and print it on serial monitor.

Third, it is plain stupid to be doing SoftwareSerial on the hardware serial pins. Stop that.
is there another way to use serial pins?
24  Using Arduino / Interfacing w/ Software on the Computer / problem with serial communication arduino - pic on: April 18, 2013, 11:21:22 pm
Hi , I want to make simple project , the project is two fire(smoke) detectors in two rooms where every smoke detector has a pic16f88 and the arduino is the controller , I wrote the code , the principle of code is the arduino send serial msgs where every pic has special msg(special number).Note :- (this step is even don't happen synchronization)
when pic receives its special msg and the pin 3(input) is high (when the fire occur) ,send serial msg(number of room) to  arduino then  arduino specify the room by print in termial monitor.
I simulate the code of pic in proteus and code of arduino in terminal monitor and work well.

1'st room (pic16f88) code:
Code:
char yt[3];
void main(){
 ANSEL  = 0;
UART1_Init(9600);                         // initialize UART1 module
Delay_ms(100);
TRISA = 0xFF;
while (1) {
  if (UART1_Data_Ready()== 1)           // if data is received
        {UART1_Read_Text(yt,"o",5);    // reads text until 'OK' is found
        if (yt[0] == '0' && yt[1]=='0' && yt[2]=='1' && PORTA==0B00001000)
        {UART1_Write_Text("001");Delay_ms(5000); }
          }           // sends back text } }

arduino mega code :
Code:
#include <SoftwareSerial.h>
SoftwareSerial myserial(15,14); // RX, TX
char i[4]={'a','a','a'};
char ch;
int index=0;
char array[2][4] = {{'0','0','1','o'},
                    {'0','0','2','o'}};
char e[4];
                   
void setup(){
 //create serial object
Serial.begin(9600);
myserial.begin(9600);
Serial.println("power on"); }

void loop(){ 
for (int i=0;i<2;i++){
  for (int p=0;p<4;p++)
{array[i][p];
myserial.write(array[i][p]);
}
r();}
}

void r(){
//have the arduino wait to receive input
while(myserial.available() > 0){
//Read the input
Serial.println("the fire in the room :");
ch = myserial.read();
i[index]= ch ;
index++;}
index=0;
if (i[0]!='a' && i[1]!='a' && i[2]!='a' ){
Serial.print(i[0]);Serial.print(i[1]);Serial.print(i[2]);
Serial.print("\n");
i[0]='a';i[1]='a';i[2]='a';
}
}

the code hasn't error, I made the pin 3 of 1'st smoke detector always high then must print in terminal monitor the number 001(every 5 seconds) but I don't know why don't print.
25  Using Arduino / General Electronics / question about Regulater 5V 7805 on: April 14, 2013, 10:21:58 am
When I the connect the output voltage of regulater 5V to pic , the voltage drop to half , why?
26  Using Arduino / Microcontrollers / simple question about digital input pic on: April 14, 2013, 09:58:57 am
Can I connect the output of regulater 5 volt (7805) to pin digital input on pic 16F88 directly without connect to ( resistor and ground ) as shown in the image ?

http://ctheds.files.wordpress.com/2007/10/digital_input.jpg
27  Using Arduino / Microcontrollers / Error msg with (accelerometer spi board) on: April 13, 2013, 07:45:23 am
HI,, I brought from website [Mikroe] accel spi board.
I faced a problem when i build the code that comes with add-on board
(eg.accel spi board) on program [Micro C Pro]
 ,,,there is an internal error that i can't understand it,

the error in (accel spi board)
{
';' expected but cs_bit found
internal error
}


28  Using Arduino / Networking, Protocols, and Devices / Re: Problem about Serial Communication on: April 08, 2013, 07:35:51 am
Let the main arduino poll the fire detector arduinos in a loop requesting a status of each detector.
Did you mean to send serial msg's in a loop by arduino , then the pic send serial msg if detects smoke and recieves special msg.
29  Using Arduino / Networking, Protocols, and Devices / Re: Problem about Serial Communication on: April 07, 2013, 03:10:48 pm
explaining more of the project , I want to connect all pic's (16F88) of fire (smoke)detectors (regardless of the number of detectors); with same points (TX,RX) of arduino Mega by cables (I initially did not want to use wireless) , if smoke detector becomes ON, the pic sends serial message to arduino mega(between them two MAX232 chips), but the problem if two detectors send in the same time.
30  Using Arduino / Networking, Protocols, and Devices / Problem about Serial Communication on: April 07, 2013, 08:06:58 am
| want to make fire detector circuit in each room in any institution and contact all circuits with arduino mega , and when the fire is done , the pic microcontroller which is contacted with circuit send serial message to arduino then arduino will define the room where the fire occurred .
 but the problem , if two rooms send serial message synchronously.
How can I solve this problem ?
Pages: 1 [2] 3 4