Hi out there,
I´ve build me an Gen7 Board with an ATMEGA 644. I flashed the 20MHz Bootloader on the uC and now I want to try some UART communications on my board.
I want to communicate via Processing IDE with my ("Fake") Arduino Board, the Gen7 Board.
In the first step, I´ve loaded the SimpleDigitalFirmata Example to my Arduino board, and I´ve loaded too the "arduino_output" SW-Example of the Arduino Lib to the Processing IDE.
For me now it is possible to switch on/off some LED´s.
I modified the Processing example as shown below:
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
color off = color(4, 79, 111);
color on = color(84, 145, 158);
int[] values = { Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW,
Arduino.LOW, Arduino.LOW, Arduino.LOW,
Arduino.LOW, Arduino.LOW, Arduino.LOW,
Arduino.LOW, Arduino.LOW, Arduino.LOW,
Arduino.LOW, Arduino.LOW, Arduino.LOW,
Arduino.LOW, Arduino.LOW, Arduino.LOW,
Arduino.LOW, Arduino.LOW, Arduino.LOW,
Arduino.LOW, Arduino.LOW, Arduino.LOW,
Arduino.LOW, Arduino.LOW, Arduino.LOW,
Arduino.LOW, Arduino.LOW, Arduino.LOW, Arduino.LOW};
void setup() {
size(970, 200);
// Prints out the available serial ports.
println(Arduino.list());
// Modify this line, by changing the "0" to the index of the serial
// port corresponding to your Arduino board (as it appears in the list
// printed by the line above).
arduino = new Arduino(this, "COM5", 57600);
// Alternatively, use the name of the serial port corresponding to your
// Arduino (in double-quotes), as in the following line.
//arduino = new Arduino(this, "/dev/tty.usbmodem621", 57600);
// Set the Arduino digital pins as outputs.
for (int i = 0; i <= 31; i++)
arduino.pinMode(i, Arduino.OUTPUT);
}
void draw() {
background(off);
stroke(on);
for (int i = 0; i <= 31; i++) {
if (values
== Arduino.HIGH)
fill(on);
else
fill(off);
rect(920 - i * 30, 30, 20, 20);
}
}
void mousePressed()
{
int pin = (950 - mouseX) / 30;
// Toggle the pin corresponding to the clicked square.
if (values[pin] == Arduino.LOW) {
arduino.digitalWrite(pin, Arduino.HIGH);
values[pin] = Arduino.HIGH;
} else {
arduino.digitalWrite(pin, Arduino.LOW);
values[pin] = Arduino.LOW;
}
}
It means now, that I have in my new Screen 32 Buttons that I can switch on/off.
Now my problem is, that not all of the Pins of my ATMEGA644 will toggle ?!
For Example Pin 1 (from the Arduino description of the ATMEGA644 shown in the appendix) wouldn´t toggle. As well as the Pin24 till 31.
But I can handle very well the other pins.
Now I think, that I have to change something in the Boards.h File of the Firmata-Lib of the Arduino.
Because there is defined which Ports are digital/analog inputs/outputs.
Is there probably a working Boards.h file especially designed for the ATMEGA644?
I want to define all the Pins, at least the Pin24-31 as digital Output.
Can someone help me?
Thank you and best regards
Rodriguz..
You can answer me in german too
Attachments:
open |
download -
Arduino_atmega644_pinout.jpg
(51.6 KB)