Connect using USB TTL adapter (CP2102)
Connections from the USB TTL adapter to the Pi:
GND (ground) > GPIO pin 06 (GND)
RXD > GPIO pin 08 (TXD)
TXD > GPIO pin 10 (RXD)
sudo screen /dev/ttyUSB0 115200
#define DEBUG
#ifdef DEBUG
#define DEBUG_PRINT(x) Serial.print (x)
#define DEBUG_PRINTDEC(x) Serial.print (x, DEC)
#define DEBUG_PRINTLN(x) Serial.println (x)
#else
#define DEBUG_PRINT(x)
#define DEBUG_PRINTDEC(x)
#define DEBUG_PRINTLN(x)
#endif
#ifdef DEBUG
Serial.begin(9600);
#endif
...
Then you can liberally scatter your code with "DEBUG_PRINT ("I think I'm here");",
all controlled by a simple "#define DEBUG"
Ako je macro definiran kao prazan npr. #define DEBUG_PRINT(x), a pozvan u kodu, samo bude izignoriran.
http://stackoverflow.com/questions/28931195/way-to-toggle-debugging-code-on-and-off
http://arduino.stackexchange.com/questions/9857/can-i-make-the-arduino-ignore-serial-print
for longer distance wire transfer
moze i bez otpornika. on u nekim slučajevima treba (za terminiranje linije u slučaju zadnjeg uređaja u lancu), ali kod nas je radilo i bez njega.
desna strana čipa je ista (napajanje i kabel). ja možeš dodati neki 100nF kond između Vcc i GND čist da malo isfiltrira napajanje.
s lijeve strane spojim zajedno RE' i DE (ovim se bira da li se signal šalje ili prima, ne može istovremeno oboje). za slanje signala, serijski TX dovedem na DI, a ova dva spojena pina spojim na +5V (receive disable, transmit enable). na drugoj strani, za primanje RO na čipu spojim na serijski RX, a ova dva pina zajedno na GND (receive enable, transmit disable).
"LowLatencyLogger" is intended to be easy to modify while providing data logging at up to 500 Hz on AVR boards without using multi-threading or interrupts.
"AnalogBinLogger" demonstrates faster logging, up to 40,000 Hz for a single pin. AnalogBinLogger uses interrupts and a timer so it is more difficult to modify for another sensor.