terça-feira, 7 de junho de 2011
segunda-feira, 6 de junho de 2011
terça-feira, 10 de maio de 2011
Segunda Apresentação - Instrumento a Laser
sábado, 7 de maio de 2011
Reta Final
Hoje passamos a tarde fazendo integração, de todos os códigos criados pelo time, no nosso programa final. E terminamos a comunicação PC-Arduíno.
Nosso programa em Java, que reproduzirá as notas tocadas, está quase pronto, só falta terminar alguns detalhes para facilitar o seu uso. Essa é a sua inteface com o usuário:
Nosso programa em Java, que reproduzirá as notas tocadas, está quase pronto, só falta terminar alguns detalhes para facilitar o seu uso. Essa é a sua inteface com o usuário:

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by | |
the Free Software Foundation, either version 3 of the License, or | |
(at your option) any later version. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of | |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
GNU General Public License for more details. | |
You should have received a copy of the GNU General Public License | |
along with this program. If not, see <http://www.gnu.org/licenses/>. | |
*/ | |
#define DEBUG 0 | |
#define LDR_COUNT 6 | |
int calibrationValue = 0; | |
int LDR[LDR_COUNT]; | |
void updateLdrsValues(){ | |
int i; | |
for( i = 0; i < LDR_COUNT; i++ ){ | |
LDR[i] = analogRead( i ); | |
} | |
} | |
void calibrateLdrs(){ | |
int i; | |
int aux = 0; | |
updateLdrsValues(); | |
for( i = 0; i < LDR_COUNT; i++ ){ | |
aux += LDR[i]; | |
} | |
calibrationValue = aux / LDR_COUNT + 50; | |
} | |
void setup(){ | |
Serial.begin( 9600 ); | |
calibrateLdrs(); | |
} | |
byte encodeData(){ | |
byte info = B0; | |
int i; | |
updateLdrsValues(); | |
for( i = 0; i < LDR_COUNT; i++ ){ | |
if( LDR[i] < calibrationValue ){ | |
info = info | ( B1 << i ); | |
} | |
} | |
return info; | |
} | |
void showData(){ | |
Serial.print( "----------\nCalibration: " ); | |
Serial.println( calibrationValue ); | |
Serial.print( "LDRs values: | " ); | |
int i; | |
for( i = 0; i < LDR_COUNT; i++ ){ | |
Serial.print( LDR[i] ); | |
Serial.print( " | " ); | |
} | |
Serial.print( "\nByte: " ); | |
Serial.println( encodeData(), DEC ); | |
} | |
void loop(){ | |
if( DEBUG ) | |
showData(); | |
else | |
Serial.write( encodeData() ); | |
delay( 500 ); | |
} |
Marcadores:
arduino,
código,
integração,
interface,
java
domingo, 1 de maio de 2011
Andamento do projeto
Olá pessoal, vim aqui só para informar que o projeto está se encaminhando para a reta final. O programa do arduino está pronto, falta apenas a construção do suporte para os lasers e ldr's e a integração do programa em java com o Arduino.
Assinar:
Postagens (Atom)