I am using the sketch below to send the bytes of the frame buffer display.screen of 1536 bytes in size, to the computer over serial communication. The result of it to my java program is a byte array with values between 127 and -128. The result I am seeking of in java program is a byte array with values between 0 and 1. How could I declare the value of i to be an unsigned byte?
#include <TVout.h>
#include <video_gen.h>
#include <SoftwareSerial.h>
#define BAUD (9600)
#define W 128
#define H 96
#define compute ((TV.hres()/8) * TV.vres())
TVout TV;
SoftwareSerial Sserial(0, 1);
void setup() {
Sserial.begin(BAUD);
delay(1000);
TV.begin(PAL, W, H);
initOverlay();
initInputProcessing();
}
void initOverlay() {
TCCR1A = 0;
TCCR1B = _BV(CS10);
TIMSK1 |= _BV(ICIE1);
EIMSK = _BV(INT0);
EICRA = _BV(ISC11);
}
void initInputProcessing() {
ADCSRA &= ~_BV(ADEN);
ADCSRB |= _BV(ACME);
ADMUX &= ~_BV(MUX0);
ADMUX |= _BV(MUX1);
ADMUX &= ~_BV(MUX2);
ACSR &= ~_BV(ACIE);
ACSR &= ~_BV(ACIC);
}
ISR(INT0_vect) {
display.scanLine = 0;
}
void loop() {
delay(1000);
TV.capture();
for (int i=0; i<compute; i++)
{
Sserial.write(display.screen[i]);
}
delay(3000);
}
float
values? – starblue Apr 28 '12 at 12:01