Show Posts
Pages: 1 [2]
16  Using Arduino / Programming Questions / Button email help? on: April 10, 2013, 04:31:27 pm
I want to do a project that when I press a button it sends an email. I have an idea of how it will work (as in what programs) but other than that Im stuck.(;
I'm not sure what the code will be but I want to do it the same way as they did it http://learn.adafruit.com/arduino-lesson-17-email-sending-movement-detector/overview but just without the sensor. Is there anyway to do this? If so how would I set it up and what would the code be?

Thanks for the help!
Ethan
17  Using Arduino / Project Guidance / Re: Button pad with arduino? on: April 01, 2013, 01:12:25 pm
ok thanks! I'll do some research on 4*5 matrix keypads. and yes the leds were used to light up the buttons;)
18  Using Arduino / Project Guidance / Button pad with arduino? on: April 01, 2013, 10:26:00 am
Yesterday I found a old button pad from a basic kids batman phone. It does work but now that I have a better home phone it was no longer needed. So I took it apart and found this button pad.http://www.flickr.com/photos/94589858@N06/. Now I want to use it with the arduino Leonardo as a keyboard with my computer and I don't care for the leds either.
I have no clue how to hook it up so if anyone could help me hook it up to the arduino Leonardo would be fantastic. As well I don't know what program/code to make for this to work so if anyone could help me out again that would be awesome!;)

Thanks for all the help!
19  Using Arduino / LEDs and Multiplexing / 8x8 led matrix Pong problem!? on: February 17, 2013, 04:25:36 pm
I set it up like here
http://playground.arduino.cc/Main/DirectDriveLEDMatrix
Heres the website where I got the code from
http://blog.bsoares.com.br/arduino/ping-pong-with-8x8-led-matrix-on-arduino
I used resistors, he didn't however I tried without the resistors and the same effect happens
https://mail-attachment.googleusercontent.com/attachment/u/0/?ui=2&ik=ebb7fefacf&view=att&th=13cea02589e86cc0&attid=0.1&disp=inline&safe=1&zw&saduie=AG9B_P-645zAms291OT_4EgBjH6o&sadet=1361136203736&sads=hUmROWGkZbh0r8VFaGJ4K7oTR5s&sadssc=1
Heres the whole setup,
https://mail-attachment.googleusercontent.com/attachment/u/0/?ui=2&ik=ebb7fefacf&view=att&th=13cea02d3253e594&attid=0.1&disp=inline&safe=1&zw&saduie=AG9B_P-645zAms291OT_4EgBjH6o&sadet=1361136273178&sads=zOm76jeC0bsxVJ3Guf7xD7CXOHQ
I made sure that the matrix was in the right way and it still shows random leds on the matrix.
I can't even control them via potentiometer.
What could it be?

Thanks for all the help!
20  Using Arduino / LEDs and Multiplexing / Re: Help with 8x8 led matrix pong! on: February 15, 2013, 07:10:42 am
nevermind, I reinstalled TimerOne and it works!
Thanks for the help!
21  Using Arduino / LEDs and Multiplexing / Re: Help with 8x8 led matrix pong! on: February 15, 2013, 06:51:12 am
yes but I'll try it again
22  Using Arduino / LEDs and Multiplexing / Help with 8x8 led matrix pong! on: February 14, 2013, 05:57:11 pm
I have a 8x8 led monocolor matrix and arduino uno smd edition as well as some ptoentiometers but when ever I try uploading the code, it keeps saying define this, when its already been defined and keeps highlighting.
Heres his website http://blog.bsoares.com.br/arduino/ping-pong-with-8x8-led-matrix-on-arduino
Heres the code
Code:
/**
  * Ping Pong with 8x8 Led Dot Matrix on Arduino
  *
  * @author  Bruno Soares
  * @website www.bsoares.com.br
  */
 
#include "TimerOne.h"
 
#define PIN_LEFT 4
 #define PIN_RIGHT 5
 
unsigned int left = 0;
 unsigned int right = 0;
 int angle = 0;
 int radians;
 
byte rows[8] = {9, 14, 8, 12, 1, 7, 2, 5};
 byte cols[8] = {13, 3, 4, 10, 6, 11, 15, 16};
 byte pins[16] = {5, 4, 3, 2, 14, 15, 16, 17, 13, 12, 11, 10, 9, 8, 7, 6};
 byte screen[8] = {0, 0, 0, 0, 0, 0, 0, 0};
 volatile byte screenRow = 0;
 volatile byte screenCol = 0;
 
int _angle;
 int _px;
 int _py;
 int _w = 7;
 int _h = 7;
 int _wall[] = {3, 3};
 int _count = 0;
 int _speed = 3;
 int _countPoints = 0;
 

void setup() {
   Timer1.initialize(100);
   for (int i = 2; i <= 17; i++)
     pinMode(i, OUTPUT);
   Timer1.attachInterrupt(doubleBuffer);
   
  Serial.begin(9600);
   
  face();
   reset();
 }
 
void doubleBuffer() {
   digitalWrite(translatePin(rows[screenRow]), LOW);
   digitalWrite(translatePin(cols[screenCol]), HIGH);
   
  screenCol++;
   if (screenCol >= 8) {
     screenCol = 0;
     screenRow++;
     if (screenRow >= 8) {
       screenRow = 0;
     }
   }
   
  if((screen[screenRow] >> screenCol) & B1 == B1) {
     digitalWrite(translatePin(rows[screenRow]), HIGH);
     digitalWrite(translatePin(cols[screenCol]), LOW);
   } else {
     digitalWrite(translatePin(rows[screenRow]), LOW);
     digitalWrite(translatePin(cols[screenCol]), HIGH);
   }
 }
 
byte translatePin(byte original) {
   return pins[original - 1];
 }
 
void allOFF() {
   for (int i = 0; i < 8; i++)
     screen[i] = 0;
 }
 
void on(byte row, byte column) {
     screen[column-1] |= (B1 << (row - 1));
 }
 
void off(byte row, byte column) {
     screen[column-1] &= ~(B1 << (row - 1));
 }
 
void calcWall()
 {
   left = analogRead(PIN_LEFT);
   right = analogRead(PIN_RIGHT);
   left = constrain(map(left, 223, 800, 0, 6), 0, 6);
   right = constrain(map(right, 223, 800, 6, 0), 0, 6);
   
  clearWall();
   
  on(1, left + 1);
   on(1, left + 2);
   on(8, right + 1);
   on(8, right + 2);
   
  _wall[0] = left;
   _wall[1] = right;
   show();
 }
 
void clearWall()
 {
   for (int i = 0; i < 8; i++)
     screen[i] &= B01111110;
 }
 
void clearGame()
 {
   for (int i = 0; i < 8; i++)
     screen[i] &= B10000001;
 }
 
void loop() {
   calcWall();
   enterFrameHandler();
   delay(50);
 }
 
void enterFrameHandler()
 {
   if (_count++ < _speed)
     return;
   
  _count = 0;
   checkCollision();
   calcAngleIncrement();
   show();
 }
 
void retorted(int angle)
 {
   Serial.println(angle);
   _angle = angle;
   
  if (++_countPoints % 5 == 0 && _speed > 1)
     _speed--;
 }
 
void resetAnim()
 {
   for (int i = 0; i < 8; i++)
   {
     screen[i] = B11111111;
     delay(25);
   }
   for (int i = 0; i < 8; i++)
   {
     screen[i] = B00000000;
     delay(25);
   }
 }
 
void face()
 {
   on(1, 1);
   on(1, 2);
   on(2, 1);
   on(2, 2);
   on(7, 1);
   on(7, 2);
   on(8, 1);
   on(8, 2);
   on(1, 1);
   on(1, 2);
   on(4, 4);
   on(4, 5);
   on(5, 4);
   on(5, 5);
   on(2, 7);
   on(7, 7);
   on(3, 8);
   on(4, 8);
   on(5, 8);
   on(6, 8);
   delay(5000);
 }
 
void reset()
 {
   resetAnim();
   
  _px = random(3, 5);
   _py = random(3, 5);
   _angle = random(0, 2) == 0 ? 0 : 180;
   _speed = 5;
   _countPoints = 0;
   
  show();
   delay(500);
 }
 
void show()
 {
   clearGame();
   on(_px + 1, _py + 1);
 }
 
void checkCollision()
 {
   if (_px == _w - 1)
   {
     if (_angle == 315 || _angle == 0 || _angle == 45)
     {
       if (_py == _wall[1] || _py == _wall[1] + 1)
       {
         if (_angle == 0 && _py == _wall[1])
           retorted(225);
         else if (_angle == 0 && _py == _wall[1] + 1)
           retorted(135);
         else if (_angle == 45 && _py == _wall[1])
           retorted(135);
         else if (_angle == 45 && _py == _wall[1] + 1)
           retorted(180);
         else if (_angle == 315 && _py == _wall[1])
           retorted(180);
         else if (_angle == 315 && _py == _wall[1] + 1)
           retorted(225);
       }
     }
   }
   else if (_px == 1)
   {
     if (_angle == 225 || _angle == 180 || _angle == 135)
     {
       if (_py == _wall[0] || _py == _wall[0] + 1)
       {
         if (_angle == 180 && _py == _wall[0])
           retorted(315);
         else if (_angle == 180 && _py == _wall[0] + 1)
           retorted(45);
         else if (_angle == 135 && _py == _wall[0])
           retorted(45);
         else if (_angle == 135 && _py == _wall[0] + 1)
           retorted(0);
         else if (_angle == 225 && _py == _wall[0])
           retorted(0);
         else if (_angle == 225 && _py == _wall[0] + 1)
           retorted(315);
       }
     }
   }
   
  if (_px == _w)
   {
     reset();
   }
   else if (_px == 0)
   {
     reset();
   }
   else if (_py == _h)
   {
     if (_angle == 45)
       _angle = 315;
     else if (_angle == 135)
       _angle = 225;
   }
   else if (_py == 0)
   {
     if (_angle == 225)
       _angle = 135;
     else if (_angle == 315)
       _angle = 45;
   }
 }
 
void calcAngleIncrement()
 {
   if (_angle == 0 || _angle == 360)
   {
     _px += 1;
   }
   else if (_angle == 45)
   {
     _px += 1;
     _py += 1;
   }
   else if (_angle == 135)
   {
     _px -= 1;
     _py += 1;
   }
   else if (_angle == 180)
   {
     _px -= 1;
   }
   else if (_angle == 225)
   {
     _px -= 1;
     _py -= 1;
   }
   else if (_angle == 315)
   {
     _px += 1;
     _py -= 1;
   }
 }
Can someone fix  the code or tell me how to fix it?
Thanks!
23  Using Arduino / LEDs and Multiplexing / 1 Player Pong with Arduino? on: February 13, 2013, 07:17:44 pm
Hello,

I have the idea to make a 1 player pong game for arduino using a 8x8 led matrix, potentiometer and arduino leonardo.
I have all the hardware plans and setup and a little of the code however, I want to make so that the oppenent will randomly move their paddle without needing any control to do so. But as well allow the non computer player to move their paddle how ever they want.
What would the code look like to do this? Is there any websites or other poeple's code that has this?

Thanks,

Cheers,
Ethan
24  Using Arduino / LEDs and Multiplexing / Help with 8x8 led matrix Pong with arduino on: February 12, 2013, 09:54:32 pm


I'm trying to make an 8x8 Led matrix Pong game with arduino. (Show here http://m.instructables.com/id/Pong-with-8x8-Led-Matrix-on-Arduino/ )
Here's the code
Code:
/**
 * Ping Pong with 8x8 Led Dot Matrix on Arduino
 *
 * @author  Bruno Soares
 * @website www.bsoares.com.br
 */

#include "TimerOne.h"

#define PIN_LEFT 4
#define PIN_RIGHT 5

unsigned int left = 0;
unsigned int right = 0;
int angle = 0;
int radians;

byte rows[8] = {9, 14, 8, 12, 1, 7, 2, 5};
byte cols[8] = {13, 3, 4, 10, 6, 11, 15, 16};
byte pins[16] = {5, 4, 3, 2, 14, 15, 16, 17, 13, 12, 11, 10, 9, 8, 7, 6};
byte screen[8] = {0, 0, 0, 0, 0, 0, 0, 0};
volatile byte screenRow = 0;
volatile byte screenCol = 0;

int _angle;
int _px;
int _py;
int _w = 7;
int _h = 7;
int _wall[] = {3, 3};
int _count = 0;
int _speed = 3;
int _countPoints = 0;


void setup() {
  Timer1.initialize(100);
  for (int i = 2; i <= 17; i++)
    pinMode(i, OUTPUT);
  Timer1.attachInterrupt(doubleBuffer);
 
  Serial.begin(9600);
 
  face();
  reset();
}

void doubleBuffer() {
  digitalWrite(translatePin(rows[screenRow]), LOW);
  digitalWrite(translatePin(cols[screenCol]), HIGH);
 
  screenCol++;
  if (screenCol >= 8) {
    screenCol = 0;
    screenRow++;
    if (screenRow >= 8) {
      screenRow = 0;
    }
  }
 
  if((screen[screenRow] >> screenCol) & B1 == B1) {
    digitalWrite(translatePin(rows[screenRow]), HIGH);
    digitalWrite(translatePin(cols[screenCol]), LOW);
  } else {
    digitalWrite(translatePin(rows[screenRow]), LOW);
    digitalWrite(translatePin(cols[screenCol]), HIGH);
  }
}

byte translatePin(byte original) {
  return pins[original - 1];
}

void allOFF() {
  for (int i = 0; i < 8; i++)
    screen[i] = 0;
}

void on(byte row, byte column) {
    screen[column-1] |= (B1 << (row - 1));
}

void off(byte row, byte column) {
    screen[column-1] &= ~(B1 << (row - 1));
}

void calcWall()
{
  left = analogRead(PIN_LEFT);
  right = analogRead(PIN_RIGHT);
  left = constrain(map(left, 223, 800, 0, 6), 0, 6);
  right = constrain(map(right, 223, 800, 6, 0), 0, 6);
 
  clearWall();
 
  on(1, left + 1);
  on(1, left + 2);
  on(8, right + 1);
  on(8, right + 2);
 
  _wall[0] = left;
  _wall[1] = right;
  show();
}

void clearWall()
{
  for (int i = 0; i < 8; i++)
    screen[i] &= B01111110;
}

void clearGame()
{
  for (int i = 0; i < 8; i++)
    screen[i] &= B10000001;
}

void loop() {
  calcWall();
  enterFrameHandler();
  delay(50);
}

void enterFrameHandler()
{
  if (_count++ < _speed)
    return;
 
  _count = 0;
  checkCollision();
  calcAngleIncrement();
  show();
}

void retorted(int angle)
{
  Serial.println(angle);
  _angle = angle;
 
  if (++_countPoints % 5 == 0 && _speed > 1)
    _speed--;
}

void resetAnim()
{
  for (int i = 0; i < 8; i++)
  {
    screen[i] = B11111111;
    delay(25);
  }
  for (int i = 0; i < 8; i++)
  {
    screen[i] = B00000000;
    delay(25);
  }
}

void face()
{
  on(1, 1);
  on(1, 2);
  on(2, 1);
  on(2, 2);
  on(7, 1);
  on(7, 2);
  on(8, 1);
  on(8, 2);
  on(1, 1);
  on(1, 2);
  on(4, 4);
  on(4, 5);
  on(5, 4);
  on(5, 5);
  on(2, 7);
  on(7, 7);
  on(3, 8);
  on(4, 8);
  on(5, 8);
  on(6, 8);
  delay(5000);
}

void reset()
{
  resetAnim();
 
  _px = random(3, 5);
  _py = random(3, 5);
  _angle = random(0, 2) == 0 ? 0 : 180;
  _speed = 5;
  _countPoints = 0;
 
  show();
  delay(500);
}

void show()
{
  clearGame();
  on(_px + 1, _py + 1);
}

void checkCollision()
{
  if (_px == _w - 1)
  {
    if (_angle == 315 || _angle == 0 || _angle == 45)
    {
      if (_py == _wall[1] || _py == _wall[1] + 1)
      {
        if (_angle == 0 && _py == _wall[1])
          retorted(225);
        else if (_angle == 0 && _py == _wall[1] + 1)
          retorted(135);
        else if (_angle == 45 && _py == _wall[1])
          retorted(135);
        else if (_angle == 45 && _py == _wall[1] + 1)
          retorted(180);
        else if (_angle == 315 && _py == _wall[1])
          retorted(180);
        else if (_angle == 315 && _py == _wall[1] + 1)
          retorted(225);
      }
    }
  }
  else if (_px == 1)
  {
    if (_angle == 225 || _angle == 180 || _angle == 135)
    {
      if (_py == _wall[0] || _py == _wall[0] + 1)
      {
        if (_angle == 180 && _py == _wall[0])
          retorted(315);
        else if (_angle == 180 && _py == _wall[0] + 1)
          retorted(45);
        else if (_angle == 135 && _py == _wall[0])
          retorted(45);
        else if (_angle == 135 && _py == _wall[0] + 1)
          retorted(0);
        else if (_angle == 225 && _py == _wall[0])
          retorted(0);
        else if (_angle == 225 && _py == _wall[0] + 1)
          retorted(315);
      }
    }
  }
 
  if (_px == _w)
  {
    reset();
  }
  else if (_px == 0)
  {
    reset();
  }
  else if (_py == _h)
  {
    if (_angle == 45)
      _angle = 315;
    else if (_angle == 135)
      _angle = 225;
  }
  else if (_py == 0)
  {
    if (_angle == 225)
      _angle = 135;
    else if (_angle == 315)
      _angle = 45;
  }
}

void calcAngleIncrement()
{
  if (_angle == 0 || _angle == 360)
  {
    _px += 1;
  }
  else if (_angle == 45)
  {
    _px += 1;
    _py += 1;
  }
  else if (_angle == 135)
  {
    _px -= 1;
    _py += 1;
  }
  else if (_angle == 180)
  {
    _px -= 1;
  }
  else if (_angle == 225)
  {
    _px -= 1;
    _py -= 1;
  }
  else if (_angle == 315)
  {
    _px += 1;
    _py -= 1;
  }
}
I know how to setup the led matrix (Arduino.cc has a  tutorial on how to hook it up 8x8) it's just how to hook up the potentiometers to go with the code. I already have the parts, all I need is how to connect the 2 potentiometers to work.

Thanks for all the help!
Cheers,
Ethan
25  Topics / Robotics / Robotics Idea? on: January 23, 2013, 10:02:16 pm
I'm thinking of making a robot that is controlled by a tv remote and has 2 hobby motors.However I have a few questions,1. Do I need a motor shield or can I just use a breadboard?2. What would the code be? I already know how to find the value of the buttons on the remote using serial monitor but don't know the code to control motors (forward,backwards,left and right) can anyone help me?

Thanks for all the help,
Ethan
26  Topics / Science and Measurement / 3 Questions on projects? on: January 12, 2013, 11:06:36 pm
I just got my Arduino (Uno SMD sparkfun starter kit-flex) and I have a couple of questions. As well I'm like a "beginner" beginner so I know very little and would greatly appreciate it if you answer basically;)

1. How do I connect my 4 digit 7-segment LED display with my 10K thermistor to make a digital thermometer? Also what is the code for that?

2. I got a Spectra Symbol SoftPot Potentiometer, what exactly is that and how can I use it, connect it and what would be the code for that?

3. Can you measure flex with a flex sensor? If so, how can I connect it and what would be the code for that?

Thanks in advance for all the help,

Cheers, Ethan
27  Topics / Science and Measurement / Help with Arduino digital thermometer!? on: January 10, 2013, 10:15:32 pm
Ok so I just ordered an Arduino (Arduino UNO SMD and it comes in Saturday) and I want to make a digital thermometer. I have never even touched one before or seem one in person. I have the 4-digit 7 segment LED, thermometer and a small red bread board with male to male jumper wires. So can anyone explain to me how to hook it up right and where or what is the code to run it on? I already know how to download the software and stuff (connecting it) but I don't know how to set it up right and what's the code to use.

Cheers,
Ethan

   
Pages: 1 [2]