Show Posts
|
|
Pages: [1] 2 3 ... 9
|
|
1
|
Using Arduino / Project Guidance / Re: Multiple max 485 communicatio
|
on: April 18, 2013, 06:08:32 am
|
Can I suggest you stop posting PDFs that don't open? You're wasting my bandwidth.
Just cut and paste from your terminal window into a quote box.
Why are you using "String" in your receiver?
i tried to insert quote , But it didn't worked for me since i could not able to cut it from terminal window . i wanted put image but they are 2 mb file . SO i am putting PDF file.
|
|
|
|
|
2
|
Using Arduino / Programming Questions / GPS parse
|
on: April 18, 2013, 05:54:00 am
|
|
Dear all,
Is there any simple code that reduce code size of tiny gps. I need only date/time/latitude/longitude/mode from RMC only. and i can use it any where in program
|
|
|
|
|
3
|
Using Arduino / Project Guidance / Re: Multiple max 485 communicatio
|
on: April 18, 2013, 05:45:08 am
|
Present code : 1 master and 2 slave. out put file attached as below. page1: without second slave connected. out put from Serial monitor slave1 page2: with both slave connected and changes in out put slave1 master:
void setup() { Serial.begin(9600);
}
void loop() { Serial.println("WELCOME ARDUINO UNO"); Serial.write("UNO IS WRITING"); delay(1000); }
Slave1 and slave2
void setup() { // put your setup code here, to run once: Serial.begin(9600);
}
void loop() { Serial.println("slave1 is running");// used in salve 1 program Serial.println("slave 2 is running");// used in slave 2 program String content = ""; char character; while(Serial.available()) { character = Serial.read(); content.concat(character); } Serial.println(content); delay(1000); }
|
|
|
|
|
6
|
Using Arduino / Project Guidance / Re: Multiple max 485 communicatio
|
on: April 18, 2013, 05:01:15 am
|
|
ya its working fine. I have attached output and code above.
SO i am trying these two things which are not working 1)interchanging master to slave and slave to master .and dumping code viceversa 2) communicate single master with two slave devices here only one salve is receiving data , as soon u connected to 2nd slave start reading garbage value
|
|
|
|
|
7
|
Using Arduino / Project Guidance / Re: Multiple max 485 communicatio
|
on: April 18, 2013, 02:46:17 am
|
I am interchanging master to slave and slave to master, Code Working is working fine if i interchange the code. Code in master
void setup() { // put your setup code here, to run once: Serial.begin(9600);
}
void loop() { Serial.println("I am master ");
String content = ""; char character; while(Serial.available()) { character = Serial.read(); content.concat(character); } Serial.println(content);
delay(1000); }
salve arduino
void setup() { // put your setup code here, to run once: Serial.begin(9600);
}
void loop() {
Serial.println("I m slave ");
Serial.write("Msp SENDING DATA");
delay(1000); }
But i am facing another problem. ...but you're not going to tell us what it is? Or post any code or output.
|
|
|
|
|
8
|
Using Arduino / Project Guidance / Re: Multiple max 485 communicatio
|
on: April 18, 2013, 02:02:04 am
|
|
ya , i made it working . Small changes made in circuit, I have added 120ohm resistor at both data lines
But i am facing another problem.
i have reverse the action , i.e Initially Arduino1 master and Arduino2 slave. changed to Arduino1 as slave and Arduino2 as master . This time i could able to receive data. Program syntax similar as pasted earlier
|
|
|
|
|
11
|
Using Arduino / Project Guidance / Multiple max 485 communicatio
|
on: April 17, 2013, 08:10:48 am
|
Dear all, Here i am attaching simple circuit for communicating two device over max485. i found below code seems work fine for some extent. during first time it read data, as soon as it complete read it start reading garbage value. Please let me know what are changes to be made in circuit to make it work. I NEED TO COMMUNICATE DEVICE AS IN LAYOUT. CONNECTION DIAGRAM REPRESENT ,PRESENT CONFIGURATION master program-> Arduino1
void setup() { // put your setup code here, to run once: Serial.begin(9600);
}
void loop() { Serial.write("Arduino write"); delay(1000); }
slave program-> arduino 2 void setup() { Serial.begin(9600);
}
void loop() { Serial.write(Serial.read()); delay(1000); }
|
|
|
|
|
12
|
Using Arduino / Project Guidance / Usage of I2c Expander.
|
on: April 02, 2013, 12:34:43 am
|
|
Dear all,
I need small clarification on below. In my project ,having there are more digital io being used than no of pins available. I have only one i2c device i.e real time clock. I have heard that using i2c expander we can control digital output.Is it true or false. If it is true can someone share me the how we do that with simple example , i.e accessing the digital ios. Or clarify I2c expander meant for connecting only I2c devices with multiple device address and not for monitoring status digital ios
|
|
|
|
|
14
|
Using Arduino / Programming Questions / Setting Arduino Time & Date
|
on: March 26, 2013, 07:12:46 am
|
|
Dear all,
Suppose assume that i am not using RTC. And using Arduino time and date lib for programming.COde will work fine with untill and unless Ardunio On. Once it get shutdown.Arduino will start from time we set for. How record the last arduino time and whenever it start it should take actual time. example like in RTC itself. Is it possible to do without RTC.
or any other way of writing time in to Arduino time library.
Moderator edit: Shouty title toned-down. AWOL
|
|
|
|
|
15
|
Using Arduino / Programming Questions / Re: Error Compiling Message
|
on: March 23, 2013, 04:16:22 am
|
This code wont because. you being configured tx and rx pin for same port Hello, I am trying to use an Ulrasonic range finder, SRF01, with SoftwareSerial, but I cannot seem to get it to work. Here is the product, http://www.robot-electronics.co.uk/htm/srf01tech.htmI get this error when I try to upload this code to my Arduino 2560. c:/users/MYNAME/desktop/stuff/arduino-1.0.1/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr6/crtm2560.o: In function `__vector_default': (.vectors+0xcc): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_51' defined in .text.__vector_51 section in core.a(HardwareSerial.cpp.o)
I am running Windows 7 (64 bit) and here is my code. From this page http://arduino.cc/forum/index.php?topic=131592.0// Code modified and developed by Will Myers and Justin Miller
#include <SoftwareSerial.h>
#define txrxPin 10 // Defines Pin 10 to be used as both rx and tx for the SRF01 #define srfAddress 0x01 // Address of the SFR01 #define getSoft 0x5D // Byte to tell SRF01 we wish to read software version #define getRange 0x53 // Byte used to get range from SRF01 in inches #define getStatus 0x5F // Byte used to get the status of the transducer
SoftwareSerial UltrasonicBus(txrxPin, txrxPin); // Sets up the SoftwareSerial with Digital Pin 10 and sets the name to "UltrasonicBus"
void setup(){ Serial.begin(19200);
UltrasonicBus.begin(9600); delay(200); // Waits some time to make sure that SRF01 is powered up Serial.println("SRF01 Test"); SRF01_Cmd(srfAddress, getSoft); // Calls a function to get the SRF01 software version while (UltrasonicBus.available() < 1); // Waits to get good data int softVer = UltrasonicBus.read(); // Read software version from SRF01 Serial.print("V:"); Serial.println(softVer); // Prints the software version to LCD03 delay(200);
Serial.println("Initialization Complete"); // After inititalization is complete you should see the correct version of your device printed to the serial monitor }
void loop(){
int max = 1; // Setup so that you can averaqe readings int sum = 0; // Currently I am not taking an average.. Max = 1 for (int count = 0; count < max; count++) { sum = sum + doRange(); // Calls a function to get range from SRF01 and sums the ranges up so that you can take an avg }
int range = sum / max;
Serial.print("Range avg = "); Serial.print(range); // Print range result to the screen Serial.println(" "); // Print some spaces to the screen to make sure space direcly after the result is clear checkLock(); // Calls a function to check if the transducer is locked or unlocked }
void SRF01_Cmd(byte Address, byte cmd){ // Function to send commands to the SRF01 pinMode(txrxPin, OUTPUT); // Set pin to output and send break by sending pin low, waiting 2ms and sending it high again for 1
digitalWrite(txrxPin, LOW); delay(2); digitalWrite(txrxPin, HIGH); delay(1); UltrasonicBus.write(Address); // Send the address of the SRF01 UltrasonicBus.write(cmd); // Send commnd byte to SRF01 pinMode(txrxPin, INPUT); // Make input ready for Rx int availableJunk = UltrasonicBus.available(); // Filter out the junk data for(int x = 0; x < availableJunk; x++){ byte junk = UltrasonicBus.read(); } }
void checkLock() { SRF01_Cmd(srfAddress, getStatus); // Call to a function that checks if the trancducer is locked or unlocked byte statusByte = UltrasonicBus.read(); // Reads the SRF01 status, The least significant bit tells us if it is locked or unlocked int status = statusByte & 0x01; // Get status of lease significan bit if(status == 0) { Serial.println("Unlocked"); // Prints the word unlocked followd by a couple of spaces to make sure space after has nothing in } else { Serial.println("Locked "); // Prints the word locked followd by a couple of spaces to make sure that the space after has nothing in } }
int doRange() { SRF01_Cmd(srfAddress, getRange); // Calls a function to get range from SRF01 while (UltrasonicBus.available() < 2); // Waits to get good data byte highByte = UltrasonicBus.read(); // Get high byte byte lowByte = UltrasonicBus.read(); // Get low byte int dist = ((highByte<<8)+lowByte); // Put them together return dist; }
All it says is error compiling, I have checked for syntax, or undefined variables, and I have all the required code. All my other sketches upload fine. Any help is GREATLY appreciated! Thanks
|
|
|
|
|