Show Posts
|
|
Pages: [1] 2
|
|
1
|
Using Arduino / Networking, Protocols, and Devices / Re: Keep Serial TX low before and after Serial Com
|
on: February 01, 2013, 06:10:23 pm
|
|
What device is it? Valentine 1 Radar Detector. They have an entire service book explaining the com data. What protocol is used? I don't know. This is my question. I know they use 8bit with 1 stop bit no parity<sp?> but I don't understand how to program the arduino so that my TX line is low before and after the data is send Normal UART? No, UART normally has two wire (TX and RX). This device does all the receiving and transmitting on the same wire by stopping going low after sending a package.
|
|
|
|
|
3
|
Using Arduino / Networking, Protocols, and Devices / Keep Serial TX low before and after Serial Com
|
on: January 31, 2013, 09:02:44 pm
|
Basically I am trying to emulate this  I try to use Serial.write but I guess the communication pin just stays high before and after. The device that I was trying to emulate communicates on only one wire. There is also ONLY ONE DATA LINE so all the sending and receiving communication is done on the same wire. So my question is, What kind of communication is this? Is there a library for this communication Protocal? Should I just use softserial? How do I write this code? void setup() { // initialize both Serial1 ports: Serial1.begin(57600);
}
void loop() { // read from port 1, send to port 0: Serial1.begin(57600); Serial1.write(0xAA); delayMicroseconds(390); Serial1.write(0xD8); delayMicroseconds(390); Serial1.write(0xEA); delayMicroseconds(390); Serial1.write(0x31); delayMicroseconds(390); Serial1.write(0x09); delayMicroseconds(390); Serial1.write(0x77); delayMicroseconds(390); Serial1.write(0x77); delayMicroseconds(390); Serial1.write(0x00); delayMicroseconds(390); Serial1.write(0x00); delayMicroseconds(390); Serial1.write(0x00); delayMicroseconds(390); Serial1.write(0x0C); delayMicroseconds(390); Serial1.write(0x00); delayMicroseconds(390); Serial1.write(0x00); delayMicroseconds(390); Serial1.write(0xA0); delayMicroseconds(390); Serial1.write(0xAB); Serial1.end(); delay(68); }
|
|
|
|
|
4
|
Using Arduino / Project Guidance / Radar Detector data loging
|
on: January 31, 2013, 06:52:24 pm
|
Basically I am building this big data logger for my car. One of the devices I will be logging is my radar detector (and also displaying warning and so on). I have a Valentine 1 Radar Detector. Lucky for me they released a entire technical book http://www.valentine1.com/v1info/ESP/At first I was happy that someone had this working on an arduino https://github.com/tz1/bluev/tree/master/bluev_sketchhttp://harleyhacking.blogspot.com/2012/05/arduino-mega-adk-to-v1-howto.htmland it works just like it was made. Basically it was a AVRTool to Arduino IDE conversion. The problem is that I don't know how to reverse engineer his C files and make them compatible with the Arduino IDE they way other libraries work. So now I am trying to start this project from scratch. I took my logic analyzer and after reading the technical book I try to develop a clone signal to better understand the way it communicated.  I try to use Serial.write but I guess the communication pin just stays high before and after. There is also ONLY ONE DATA LINE so all the sending and receiving communication is done on the same wire. So my question is, What kind of communication is this?There is also ONLY ONE DATA LINE so all the sending and receiving communication is done on the same wire. Is there a library for this communication Protocal? Should I just use softserial? I know that the other guy hook the TXPin and the MOSI pin (it a Mega) to the data line. I am only trying to replicated the radar dector signal just to know how the display commands work exactly. I didn't understand page 23 on the manual.
|
|
|
|
|
5
|
Using Arduino / Programming Questions / Re: Can someone explain to me what this part in the SDFatLib example means?
|
on: March 24, 2011, 03:08:31 pm
|
/* * Append Example * * This sketch shows how to use open for append. * The sketch will append 100 line each time it opens the file. * The sketch will open and close the file 100 times. */ #include <SdFat.h>
// file system object SdFat sd;
// create Serial stream ArduinoOutStream cout(Serial);
// store error strings in flash to save RAM #define error(s) sd.errorHalt_P(PSTR(s)) //------------------------------------------------------------------------------ void setup() { // filename for this example char filename[] = "APPEND.TXT"; Serial.begin(9600); // pstr() stores strings in flash to save RAM cout << endl << pstr("Type any character to start\n"); while (!Serial.available());
// initialize the SD card at SPI_HALF_SPEED to avoid bus errors with // breadboards. use SPI_FULL_SPEED for better performance. if (!sd.init(SPI_HALF_SPEED)) sd.initErrorHalt();
cout << pstr("Appending to: ") << filename;
for (uint8_t i = 0; i < 100; i++) { // open stream for append ofstream sdout(filename, ios::out | ios::app); if (!sdout) error("open failed"); // append 100 lines to the file for (uint8_t j = 0; j < 100; j++) { // use int() so byte will print as decimal number sdout << "line " << int(j) << " of pass " << int(i); sdout << " millis = " << millis() << endl; } // close the stream sdout.close(); if (!sdout) error("append data failed"); // output progress indicator if (i % 25 == 0) cout << endl; cout << '.'; } cout << endl << "Done" << endl; } //------------------------------------------------------------------------------ void loop() {}
|
|
|
|
|
6
|
Using Arduino / Programming Questions / Can someone explain to me what this part in the SDFatLib example means?
|
on: March 24, 2011, 03:08:13 pm
|
I under stand most of this code including the cout << which is the old way to print stuff out in C++. I am confuse about this part for (uint8_t j = 0; j < 100; j++) { // use int() so byte will print as decimal number sdout << "line " << int(j) << " of pass " << int(i); sdout << " millis = " << millis() << endl; } From SDFatLibV2 example append What is uint8_t and why not use int? Also why did they use sdout << instead of sdout.print? Is this just a way to of coding? Next post has the full code.
|
|
|
|
|
12
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: Help with values and calling them up.
|
on: April 11, 2010, 01:45:20 pm
|
#include <LedControl.h> #include <Time.h> #define TIME_MSG_LEN 11 // time sync to PC is HEADER followed by unix time_t as ten ascii digits #define TIME_HEADER 'T' // Header tag for serial time sync message #define TIME_REQUEST 7 // ASCII bell character requests a time sync message
LedControl lc=LedControl(12,11,10,1);
char *ptss; char *ptst; char sec2[60][1] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7}; char sec1[60][1] = { 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1};
void setup() { Serial.begin(9600); setSyncProvider( requestSync); //set function to call when sync required Serial.println("Waiting for sync message"); /* The MAX72XX is in power-saving mode on startup, we have to do a wakeup call */ lc.shutdown(0,false); /* Set the brightness to a medium values */ lc.setIntensity(0,10); /* and clear the display */ }
void digitalClockDisplay(){ // digital clock display of the time Serial.print(second()); Serial.print(" "); Serial.print(*ptss); Serial.print(","); Serial.print(*ptst); Serial.println(); }
void printDigits(int digits){ // utility function for digital clock display: prints preceding colon and leading 0 Serial.print(":"); if(digits < 10) Serial.print('0'); Serial.print(digits); }
void processSyncMessage() { // if time sync available from serial port, update time and return true while(Serial.available() >= TIME_MSG_LEN ){ // time message consists of a header and ten ascii digits char c = Serial.read() ; Serial.print(c); if( c == TIME_HEADER ) { time_t pctime = 0; for(int i=0; i < TIME_MSG_LEN -1; i++){ c = Serial.read(); if( c >= '0' && c <= '9'){ pctime = (10 * pctime) + (c - '0') ; // convert digits to a number } } setTime(pctime); // Sync Arduino clock to the time received on the serial port } } }
time_t requestSync() { Serial.print(TIME_REQUEST,BYTE); return 0; // the time will be sent later in response to serial mesg }
void loop(){ if(Serial.available() ) { processSyncMessage(); } if(timeStatus()!= timeNotSet) { digitalWrite(13,timeStatus() == timeSet); // on if synced, off if needs refresh digitalClockDisplay(); char *ptss = sec1[second()]; char *ptst = sec2[second()]; // lc.setLed(0,*ptss,true); }
delay(1000); }
I am sorry. I just didn't want to have like a very long annoying post
|
|
|
|
|
13
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: Help with values and calling them up.
|
on: April 11, 2010, 01:27:38 pm
|
Well i am making some progress. Thank you To work with this i try to debug it using the Serial Monitor. My problem is that i get this Æ thingy appearing on my output for ptss and ptst. I bolded the main problem. libarary BLAH BLAh
char sec2[60][1] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7}; //Tables
char sec1[60][1] = { 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1}; //Tables
void setup() { blah blah blah for serial output }
void digitalClockDisplay(){ Serial.print(second()); // digital clock display of the time Serial.print(" "); Serial.print(*ptss); //Displays one number of the first Array Serial.print(","); Serial.print(*ptst); //Displays one number of the second Array Serial.println(); }
void loop(){ digitalClockDisplay(); //Outputs the stuff in digitalClockDisplay on the serial monitor char *ptss = sec1[second()]; char *ptst = sec2[second()]; // lc.setLed(0,*ptss,true); }
delay(1000); }
I should be getting things like 01 00,01 02 00,02 .. 59 07,00 00 07,01 but i get 01 Æ,Æ 02 Æ,Æ ... 59 Æ,Æ 00 Æ,Æ
|
|
|
|
|
14
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: Help with values and calling them up.
|
on: April 11, 2010, 11:32:14 am
|
So now i get this "Illegal Const Char to Char conversion" Librarys blah blah blah
// _## = seconds and "#,#" is the row and column value for the leds const char _01 = "0,0"; //At second 01 the value will be 0,0 const char _02 = "0,1"; //At second 02 the value will be 0,1 const char _03 = "0,2"; ..... const char _58 = "7,3"; const char _59 = "7,4"; //At second 59 the value will be 7,1 const char _00 = "7,5"; //At second 00 the value will be 7,2
void setup(){ blah blah }
void loop(){ lc.setLed(0,"_second()",true); }
also at the bottom where "lc.setLed(0,"_second()",true);" how can i make the second() to call up my variable and for the entire thing can work. Sorry. i am a extreme n00b.
|
|
|
|
|
15
|
Forum 2005-2010 (read only) / Syntax & Programs / Help with values and calling them up.
|
on: April 11, 2010, 10:47:15 am
|
I am trying to make something using the Time library and the Ledcontroller library to turn a certain led on a certain given second. I am not sure how variables and values work. And i worst don't know how to call one up. The time library uses "second()" to determine current second. For the ledcontroller i use the command "lc.setLed(0,2,6,true);" to turn on the led on the row 2, column 6 So i wanted to do something like Librarys blah blah blah
int 01 = 2,6
void setup(){ blah blah }
void loop(){ lc.setLed(0,"second()",true); }
I just don't understand C. Anyone can sheed some light on to my problem. I was at LadyAda/Adafruit website taking the tutorials.
|
|
|
|
|