Skip to content

Commit

Permalink
examples updated
Browse files Browse the repository at this point in the history
  • Loading branch information
lcgamboa committed Jul 17, 2019
1 parent b2c52e3 commit bbf29d7
Show file tree
Hide file tree
Showing 61 changed files with 108 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/examples/board_5/atmega328/LED_matrix_MAX72xx/Readme.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<body>
<h1> LED matrix MAX7211 </h1>
<pre>
matriz_led.ino

Exemplo PONG
Livro Arduino Básico de Michael McRoberts

</pre>


<a href="https://github.com/lcgamboa/picsimlab/blob/master/docs/examples/board_5/atmega328/LED_matrix_MAX72xx/src/matriz_led.ino" target="_blank">matriz_led.ino</a>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
Exemplo PONG
Livro Arduino Básico de Michael McRoberts
*/

//inclui biblioteca LedControl:http://playground.arduino.cc/Main/LedControl
#include "LedControl.h"

LedControl myMatrix = LedControl(12, 11, 10, 1); // cria uma instância de uma Matriz
//pino 12 - DIN
//pino 11 - CLK
//pino 10 - CS
int column = 1, row = random(8)+1; // decide em que ponto a bola deve iniciar
int directionX = 1, directionY = 1; // certifica-se de que ela vai primeiro da esquerda para a direita
int paddle1 = 5, paddle1Val; // pino e valor do potenciômetro
int speed = 300; // velocidade
int counter = 0, mult = 10; // variáveis auxiliares para controle de velocidade


void setup() {
myMatrix.shutdown(0, false); // habilita o display
myMatrix.setIntensity(0, 1); // define o brilho dos leds
myMatrix.clearDisplay(0); // limpa o display
randomSeed(analogRead(0)); //
}


void loop() {

paddle1Val = analogRead(paddle1); //le valor do potenciometro
paddle1Val = map(paddle1Val, 200, 1024, 1,6); //mapeia valor para entre 1 e 6

column += directionX; //atualiza valor da coluna
row += directionY; //atualiza valor da linha

//verifica se boa atingiu a raquete
if (column == 6 && directionX == 1 && (paddle1Val == row || paddle1Val+1 == row
|| paddle1Val+2 == row))
{
directionX = -1; //rebate bola
}

//verica se bola atingiu paredes: topo, base ou lateral esquerda
if (column == 0 && directionX == -1 ) {directionX = 1;}
if (row == 7 && directionY == 1 ) {directionY = -1;}
if (row == 0 && directionY == -1 ) {directionY = 1;}

//caso tenha atingido a coluna 7, significa que ultrapassou a raquete
if (column == 7) { oops(); } //chama a função oops, para finalizar o jogo


myMatrix.clearDisplay(0); // limpa a tela para o próximo quadro de animação

myMatrix.setLed(0, column, row, HIGH); //desenha bola na linha e coluna atual

//desenha raquete na coluna 7
myMatrix.setLed(0, 7, paddle1Val, HIGH);
myMatrix.setLed(0, 7, paddle1Val+1, HIGH);
myMatrix.setLed(0, 7, paddle1Val+2, HIGH);

if (!(counter % mult)) {speed -= 5; mult * mult;}
delay(speed);
counter++;
}

void oops()
{
for (int x=0; x<3; x++)
{
myMatrix.clearDisplay(0);
delay(250);
for (int y=0; y<8; y++)
{
myMatrix.setRow(0, y, 255);
}
delay(250);
}
// reinicia todos os valores
counter=0;
speed=300;
column=1;
row = random(8)+1; // escolhe uma nova posição inicial
}
4 changes: 4 additions & 0 deletions docs/examples/examples_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@
<td width="20%"><a href="../hex/board_5/atmega328/LCD_pcf8833.pzw" target="_blank" >Download (pzw)</a></td>
<td width="20%"><a href="../../wasm/picsimlab.html?../picsimlab/hex/board_5/atmega328/LCD_pcf8833.pzw" target="_blank" >Online Simulator (wasm)</a></td>
<td width="20%"><a href="../../asm.js/picsimlab.html?../picsimlab/hex/board_5/atmega328/LCD_pcf8833.pzw" target="_blank" >Online Simulator (asm.js)</a></td></tr>
<tr><td>LED_matrix_MAX72xx</td><td width="20%"><a href=board_5/atmega328/LED_matrix_MAX72xx/Readme.html>Help / Source Code</a>
<td width="20%"><a href="../hex/board_5/atmega328/LED_matrix_MAX72xx.pzw" target="_blank" >Download (pzw)</a></td>
<td width="20%"><a href="../../wasm/picsimlab.html?../picsimlab/hex/board_5/atmega328/LED_matrix_MAX72xx.pzw" target="_blank" >Online Simulator (wasm)</a></td>
<td width="20%"><a href="../../asm.js/picsimlab.html?../picsimlab/hex/board_5/atmega328/LED_matrix_MAX72xx.pzw" target="_blank" >Online Simulator (asm.js)</a></td></tr>
<tr><td>servo_Knob</td><td width="20%"><a href=board_5/atmega328/servo_Knob/Readme.html>Help / Source Code</a>
<td width="20%"><a href="../hex/board_5/atmega328/servo_Knob.pzw" target="_blank" >Download (pzw)</a></td>
<td width="20%"><a href="../../wasm/picsimlab.html?../picsimlab/hex/board_5/atmega328/servo_Knob.pzw" target="_blank" >Online Simulator (wasm)</a></td>
Expand Down
Binary file modified docs/hex/board_1/PIC16F628A/desbravando_o_pic16F628A_dimmer.pzw
Binary file not shown.
Binary file modified docs/hex/board_1/PIC16F628A/desbravando_o_pic16F628A_ex1.pzw
Binary file not shown.
Binary file modified docs/hex/board_1/PIC16F628A/desbravando_o_pic16F628A_ex2.pzw
Binary file not shown.
Binary file modified docs/hex/board_1/PIC16F628A/desbravando_o_pic16F628A_ex3.pzw
Binary file not shown.
Binary file modified docs/hex/board_1/PIC16F628A/desbravando_o_pic16F628A_ex4.pzw
Binary file not shown.
Binary file modified docs/hex/board_1/PIC16F628A/desbravando_o_pic16F628A_ex5.pzw
Binary file not shown.
Binary file modified docs/hex/board_1/PIC16F628A/desbravando_o_pic16F628A_ex6.pzw
Binary file not shown.
Binary file modified docs/hex/board_1/PIC16F628A/test_b1.pzw
Binary file not shown.
Binary file modified docs/hex/board_1/PIC16F648A/test_b1.pzw
Binary file not shown.
Binary file modified docs/hex/board_1/PIC16F84A/test_b1.pzw
Binary file not shown.
Binary file modified docs/hex/board_2/PIC16F628A/LCD_pcf8833.pzw
Binary file not shown.
Binary file modified docs/hex/board_2/PIC16F628A/test_b2.pzw
Binary file not shown.
Binary file modified docs/hex/board_2/PIC16F648A/test_b2.pzw
Binary file not shown.
Binary file modified docs/hex/board_2/PIC16F84A/test_b2.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC16F777/test_b3.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC16F877A/Demo_Mclab2_16F877A.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC16F877A/LCD_pcd8544.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC16F877A/conectando_o_pic16f877A_01.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC16F877A/conectando_o_pic16f877A_02.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC16F877A/conectando_o_pic16f877A_03.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC16F877A/conectando_o_pic16f877A_04.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC16F877A/conectando_o_pic16f877A_05.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC16F877A/conectando_o_pic16f877A_06.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC16F877A/conectando_o_pic16f877A_07.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC16F877A/conectando_o_pic16f877A_08.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC16F877A/conectando_o_pic16f877A_09.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC16F877A/conectando_o_pic16f877A_10.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC16F877A/test_b3.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC18F452/test_b3.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC18F4520/test_b3.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC18F4550/test_b3.pzw
Binary file not shown.
Binary file modified docs/hex/board_3/PIC18F4620/test_b3.pzw
Binary file not shown.
Binary file modified docs/hex/board_4/PIC16F777/test_b4.pzw
Binary file not shown.
Binary file modified docs/hex/board_4/PIC16F877A/test_b4.pzw
Binary file not shown.
Binary file modified docs/hex/board_4/PIC18F452/test_b4.pzw
Binary file not shown.
Binary file modified docs/hex/board_4/PIC18F4520/test_b4.pzw
Binary file not shown.
Binary file modified docs/hex/board_4/PIC18F4550/Parts_Demo.pzw
Binary file not shown.
Binary file modified docs/hex/board_4/PIC18F4550/Serial_lcd.pzw
Binary file not shown.
Binary file modified docs/hex/board_4/PIC18F4550/espmsim_server.pzw
Binary file not shown.
Binary file modified docs/hex/board_4/PIC18F4550/srtank_test.pzw
Binary file not shown.
Binary file modified docs/hex/board_4/PIC18F4550/test_b4.pzw
Binary file not shown.
Binary file modified docs/hex/board_4/PIC18F45K50/test_b4.pzw
Binary file not shown.
Binary file modified docs/hex/board_4/PIC18F4620/test_b4.pzw
Binary file not shown.
Binary file modified docs/hex/board_5/atmega328/ATmegaBOOT_168_atmega328.pzw
Binary file not shown.
Binary file modified docs/hex/board_5/atmega328/AnalogInOutSerial.pzw
Binary file not shown.
Binary file modified docs/hex/board_5/atmega328/LCD_hd44780.pzw
Binary file not shown.
Binary file modified docs/hex/board_5/atmega328/LCD_pcd8544.pzw
Binary file not shown.
Binary file modified docs/hex/board_5/atmega328/LCD_pcd8544_test.pzw
Binary file not shown.
Binary file modified docs/hex/board_5/atmega328/LCD_pcf8833.pzw
Binary file not shown.
Binary file not shown.
Binary file modified docs/hex/board_5/atmega328/display_bargraph.pzw
Binary file not shown.
Binary file modified docs/hex/board_5/atmega328/espmsim_server.pzw
Binary file not shown.
Binary file modified docs/hex/board_5/atmega328/game_lcd.pzw
Binary file not shown.
Binary file modified docs/hex/board_5/atmega328/game_marduino.pzw
Binary file not shown.
Binary file modified docs/hex/board_5/atmega328/game_snake.pzw
Binary file not shown.
Binary file modified docs/hex/board_5/atmega328/servo_Knob.pzw
Binary file not shown.
Binary file modified docs/hex/board_5/atmega328/srtank_test.pzw
Binary file not shown.
Binary file modified docs/hex/board_5/atmega328/stepper_onerevolution.pzw
Binary file not shown.

0 comments on commit bbf29d7

Please sign in to comment.