Show Posts
Pages: [1]
1  Community / Exhibition / Gallery / Polar and Live Plotters on Arduino and MakerBeams on: December 02, 2012, 01:40:49 pm
Just finished documenting two plotter projects I thought I'd share.

The first one is a Polar Plotter, meaning it has a rotating, extendable arm, that can be programmed to run a plot sequence. It supports drawing lines, rects, circles and text. The font used when drawing text is created with a Java program where you can load any truetype font and generate code that's useful for the Arduino program. The documentation might be useful for someone doing something similar. I think the construction or the font generation might be highlights of interest otherwise. The docs and full code is available on GitHub: http://roxen.github.com/polar-plotter/. There's also a video there.

The other project is a Live Plotter that is controlled from a browser. It has more of a traditional construction than the Polar Plotter. The main feature is that you can draw on an HTML5 canvas in the browser which sends drawing commands via a websocket to a server which in turn sends the commands to the Arduino board via serial comm using the usb cable. This project is documented at http://roxen.github.com/live-plotter/ and does also have a video.
2  Using Arduino / Programming Questions / Re: Problem reading PROGMEM data dynamically on: April 01, 2012, 03:44:45 pm
Marek080: Your tip did the trick! Thank you very much. The array is now read as it should be. I obviously failed getting a proper source pointer. I'll check the flash lib when the page is back up.

PaulS: The example program is heavily simplified and I can now see it is misleading. I actually do need to use flash storage. What I am trying to store is a font. I am storing the coordinates for the outline of 94 characters where each character takes 40-140 ints to represent. I'm building a plotter and want to be able to draw text. I will try to shrink and translate the coordinates so they fit as bytes though.
3  Using Arduino / Programming Questions / Problem reading PROGMEM data dynamically [SOLVED] on: April 01, 2012, 09:56:43 am
I have a problem reading int arrays from progmem. I am storing nested int arrays. When I hardcode which sub array to read from progmem into my in-memory array all works fine. When I try to load it dynamically it fails and something random is placed in my in-memory array.

This is the code:

Code:
#include <avr/pgmspace.h>

const int START_CHAR_VALUE = 97;
int char_0[] PROGMEM = { 221, 124 };
int char_1[] PROGMEM = { 252, 70 };
int char_2[] PROGMEM = { 205, 70 };
int char_3[] PROGMEM = { 252, 70 };
int char_4[] PROGMEM = { 223, 72 };
const int CURR_CHAR_ARRAY_SIZE = 2;
int curr_char[CURR_CHAR_ARRAY_SIZE];
PROGMEM const int* chars[] = {char_0, char_1, char_2, char_3, char_4};


void setup() {
  Serial.begin(9600);
}

void load(int charVal) {
    memcpy_P(curr_char, chars[charVal], CURR_CHAR_ARRAY_SIZE * 2);
}

void loop() {

  memcpy_P(curr_char, chars[3], CURR_CHAR_ARRAY_SIZE * 2);
  Serial.println(curr_char[0]);
  // Correctly prints 252

  load(3);
  Serial.println(curr_char[0]);
  // Prints something else

  delay(2000);
}

The first printout correctly prints the expected value. The other one prints something else.

Any suggestions on what I am doing wrong?
Pages: [1]