| Arduino Forum ::  Members :: Stan09
 Show Posts Pages: [1] 2 3 4
 1 Using Arduino / LEDs and Multiplexing / Re: Rainbowduino drawLine - please explain on: November 02, 2013, 02:32:39 am On the second thought, it's probably 'a feature'.Seems like this is a simplest implementation of Bresenham valid only for one octant where x1>x0 and y1>y0Grabbed fromhttp://groups.csail.mit.edu/graphics/classes/6.837/F99/grading/asst2/turnin/rdror/Bresenham.java:Code:void drawLine2(int x0, int y0, int x1, int y1, uint32_t color){  boolean xy_swap=false;   if (abs(y1 - y0) > abs(x1 - x0)) {     xy_swap = true;     int temp = x0;     x0 = y0;     y0 = temp;     temp = x1;     x1 = y1;     y1 = temp; } // If line goes from right to left, swap the endpoints   if (x1 - x0 < 0) {    int temp = x0;    x0 = x1;    x1 = temp;    temp = y0;    y0 = y1;    y1 = temp;    }   int x,                   // Current x position  y = y0,                  // Current y position  e = 0,                   // Current error  m_num = y1 - y0,         // Numerator of slope  m_denom = x1 - x0,       // Denominator of slope  threshold  = m_denom/2;  // Threshold between E and NE increment   for (x = x0; x < x1; x++) {    if (xy_swap) Rb.setPixelXY(y,x,color);    else Rb.setPixelXY(x,y,color);  e += m_num;    // Deal separately with lines sloping upward and those    // sloping downward   if (m_num < 0) { if (e < -threshold) {     e += m_denom;     y--; }    }    else if (e > threshold) { e -= m_denom; y++;    }  }  if (xy_swap)    Rb.setPixelXY(y,x,color);  else Rb.setPixelXY(x,y,color);  }This seems to be working correctly.
 2 Using Arduino / LEDs and Multiplexing / Rainbowduino drawLine - please explain on: November 02, 2013, 01:49:44 am I use library Rainbowduino 3.0 with Rainbowduino shield and common anode RGB LED matrix 8x8Code:drawLine(0,0,7,7,) draws diagonal line.But why Code:drawLine(0,7,7,0,) draws horizontal line, exactly as Code:drawLine(0,7,7,7,)?I s this a bug or a feature?
 3 Using Arduino / Project Guidance / Re: olimex ekg on: December 24, 2012, 04:14:54 pm Just FYI, I posted some of my results with ECG shield  on OLIMEX forum:https://www.olimex.com/forum/index.php?topic=572.0As per displaying ECG on LCD, I'd rather go for smthng like Processing application ECG viewer; tiny LCD screen would not reflect any additional information on ECG shape. And also, keep in mind that the cable they provide is of very low quality, so you should not expect good result from it. ECG picture they give in .pdf application - I don't know how they actually produced such an image.
 4 Using Arduino / Sensors / Re: How to connect piezo accelerometer? on: December 14, 2012, 12:18:01 pm Thanks a lot for your help, dc42!Now it really works, so I am acquiring and storing about 28000 points/sec with Arduino Mega.
 5 Using Arduino / Sensors / Re: How to connect piezo accelerometer? on: December 13, 2012, 04:41:36 pm So it should be something like this?I don't quite understand why do I need R1 at all? It's not a part of high pass filter, right?Is it something related to high output impedance of the sensor?
 6 Using Arduino / Sensors / Re: How to connect piezo accelerometer? on: December 13, 2012, 04:28:24 pm dc42, thank you for the prompt response!this is my current connection:Resistors are 15k (left) and 150k (right), capacitor 0.33 mFWith this setup I can only see positive accelerations.What should i change to see both negative and positives?May be, I should connect R1 and R2 not to the Gnd, but to something like +2v from simple voltage divider?
 7 Using Arduino / Sensors / How to connect piezo accelerometer? on: December 13, 2012, 03:03:21 pm I am trying to read  piezo accelerometer ACH-01 data with Arduino;I am confused with interface circuit it requires. Data sheet says it need biased power supply and provides a simple schematic with -5V/+5V supply; there is another uni-polar alternative with two op-amps;Is there any simpler way to interface Arduino with this accelerometer?If I connect it to Gnd, +5V and to analog ping through RC high pass filter, it shows accelerations, but only top half of acceleration wave - I vaguely understand it has something to do with that biasing. Another thing I don't understand about it - why it requires high-pass filter?I tried connecting it directly to gnd, +5V and analog pin to read output voltage; when untouched  the output is about 0; if I give it a little knock, the output momentarily goes to 2-3 V and then goes back to zero _very slow_, like, for a second or so. Why?
 8 Using Arduino / Installation & Troubleshooting / Re: Arduino MEGA reboots with digital pin 5 set to high on: December 09, 2012, 11:10:05 pm Solved. Initial assumption was correct - in case of intmittent and strange issues - this is a faulty hardware.But that was really nasty one: I disconnected _everything from the button soldered on Adafruit datalogger board, pull-dopwn resistor, pin connection  - I only had Vcc on one pin and nothing at all on all other 3 pins - and it still effectively short-cut power when pushed. I just removed the button and re-soldered it at different location, further away from the very edge -  and everything works now. My suggestion - Datalogger PCB micro-cracks, faulty middle-layer, or, it probably might be - some parasitic feedback effect.
 9 Using Arduino / Installation & Troubleshooting / Re: Mega 2560 randomly hanging on: December 09, 2012, 12:11:34 pm Interesting. What exactly 3 characters? Any link to more detailed info on this?
 10 Using Arduino / Installation & Troubleshooting / Arduino MEGA reboots with digital pin 5 set to high on: December 09, 2012, 04:37:09 am I am totally lost.I placed  a button on digital 5, with pull-down resistor, when button pressed it gets +5v.I also have somewhat complicated sketch which on first button press reads sensor data into attached QuadRAM board, then (on next button press) copies RAM into SD file; it also communicates some data (file name, storage progress etc) on serial LCD.SD card is located on Adafruit datalogger board.Libraries loaded are SD, I2cMaster.Sometimes (without changing anything!) it stops working: when I press the button, the board just  reboots; moreover, it reboots with _power shortage_ (!!) - I can see it when LCD backlight blinks. If I just keep the button pressed, all LEDs are down.When the board gets into that strange mode - it stays there even if I upload some other simple sketch, even with switching power off and on several times. Then, after a while (I still cannot figure after what actions) it gets to normal.From  my experience when any device  behaves that strange, it is most probably hardware problem.But still, - can anybody come up with at least a hint, what could it be (besides faulty board)?I have  a feeling there is some "gray area" related to bootloader issues, when it switches to permanent reset loop or something. Can it be somehow related?I do understand my description sounds very poor and messy and indeterminate. But so is the problem - it is intermittent and very unstable.
 11 Using Arduino / Installation & Troubleshooting / Re: Mega 2560 randomly hanging on: December 09, 2012, 04:16:59 am Obviously, uploading a sketch.I also have multiple issues like that.I have a feeling there is some 'gray area' somehow related to MEGA bootloader.Sketch is complicated enough, with Adafruit datalogger shioeld, LCD shield and QuadRAM shield.It might be working perfectly well for days, than something happens and you cannot upload anymore.Sometimes uploading another  simple sketch helps, sometimes it does not.My common impression is that Arduino MEGA 2560 is very unstable board, hardly useful for anything more complicated than blinking LEDs BTW, Ard DUE is even  worse.
 12 Using Arduino / Sensors / ADXL193: ST pin? on: December 03, 2012, 02:20:47 pm I can't figure out from datasheet how I should connect ST pin?I need no self-test, just for regular reading from OUT pin?Should I ground ST or just leave it hanging?
 13 Products / Arduino Due / Re: wrong readings from ADXL345 on: November 27, 2012, 10:13:36 am well, since it is not 65535, 65535,65535 but -1,-1,-1 - this proves it is not 'int' format, this is something else. Might be bad contact somewhere, f.e. Try regular Arduino with the same sketch?