Show Posts
Pages: 1 2 [3] 4 5 ... 11
31  Using Arduino / Project Guidance / making two arduinos communicate wirelessly on: April 01, 2013, 10:23:38 pm
Hello all,

I'm working on a project in which I want to make two dolls. With the aid of some servos and force-sensing resistors, I'm going to make it such that when each doll is being held by an individual person, and one of those people hugs his/her respective doll, the other doll hugs the other individual. I'm planning on controlling each doll with a separate arduino (well...technically, a flora: http://www.adafruit.com/products/659)

I'm looking for a good protocol to make the two arduinos communicate wirelessly. What do you guys recommend I use? Xbee? Transceivers? I'd appreciate some input (no pun intended, heh). Thank you.
32  Using Arduino / Motors, Mechanics, and Power / Re: Driving fan using transistor on: March 23, 2013, 03:37:40 pm
I tried reversing the diode direction and it didn't do anything. Could I have damaged the diode or the transistor with the short?
33  Using Arduino / Motors, Mechanics, and Power / Driving fan using transistor on: March 23, 2013, 03:29:02 pm
Hi everyone,

I'm using an 8.4V battery pack to power an Attwood Turbo 3000 fan and a TIP41C to drive it. The circuit I'm using basically looks like this (except the diode is reversed and the Arduino ground is connected to the battery ground): http://i.imgur.com/dYAa5.png

However, I need to be able to use code to power the fan on and off at various times. This is what I wrote, but the fan is perpetually turned on, regardless:

Code:
int fanPin = 7;

void setup() {
  Serial.begin(9600);
  pinMode(fanPin, OUTPUT);
}

void loop() {
  digitalWrite(fanPin, HIGH);
  Serial.println("high");
  delay(2000);
  digitalWrite(fanPin, LOW);
  Serial.println("low");
  delay(2000);
}

Any ideas on what I might need to do? Thanks!
34  Using Arduino / Programming Questions / Re: keyboard.print vs. keyboard.write vs. keyboard.press? on: March 04, 2013, 09:51:47 pm
Thanks so much for your help, guys!
35  Using Arduino / Programming Questions / Re: arduino leonardo keystrokes on: March 04, 2013, 06:51:54 pm
Never mind, I figured out my problem! I should have been using keyboard.print instead of keyboard.press. smiley
36  Using Arduino / Programming Questions / keyboard.print vs. keyboard.write vs. keyboard.press? on: March 04, 2013, 06:47:28 pm
I was reading up on keystrokes here: http://arduino.cc/en/Reference/MouseKeyboard

I'm still not entirely sure what the differences are between those three functions. Could somebody please explain the differences to me a bit better? I'm writing a program that involves sending keystrokes to my computer, and I'm not quite sure which one is the appropriate one to use. Thanks.
37  Using Arduino / Programming Questions / arduino leonardo keystrokes [solved] on: March 04, 2013, 06:09:30 pm
Hello everyone,

I'm making a book, and I put a switch on each page that outputs a LOW to the Arduino when it's open and a HIGH when it's closed. There's a webcomic that I made (http://allotrope-dome.net/advdesign/innergirl/ — not quite cross-browser compatible yet so it might look wonky to some of you), and I'm trying to implement some keystrokes that navigate to a different webcomic panel when a new page is opened.

I got the page-turning algorithm down fine, but there seems to be a problem with the keystrokes. Only the first page/panel works. When I turn the pages, it always prints the correct page to the console, but the keystrokes simply do not work.

Here is my code for page 1, for example (I only have three pages wired/coded so far. Pages 2 and 3 follow more or less the same logic). I also put in the variables I'm using:

Code:
// assign pins for pages 1, 2, and 3
int page1 = 8;
int page2 = 9;
int page3 = 10;

// variable that changes whenever user turns to a specific page
int currentPage = 0;

// char variables created for tab and return commands
char tabKey = KEY_TAB;
char returnKey = KEY_RETURN;

// if only page 1 is low, and the current page isn't already 1:
  if(pageState1 == 0 && pageState2 != 0 && pageState3 != 0 && currentPage != 1) {
    Serial.print("state of page 1:");
    Serial.println(pageState1);
    // if the user is just opening the book now
    if(currentPage == 0) {
      Serial.println("about to hit tab once");
      Keyboard.begin();
      Keyboard.press(tabKey);
      Serial.println("about to hit return");
      Keyboard.press(returnKey);
      Keyboard.end();
    }
    // if the user was on page 2 previously
    if(currentPage == 2) {
      Serial.println("about to hit tab 7x");
      Keyboard.begin();
      Keyboard.press(tabKey);
      Keyboard.press(tabKey);
      Keyboard.press(tabKey);
      Keyboard.press(tabKey);
      Keyboard.press(tabKey);
      Keyboard.press(tabKey);
      Keyboard.press(tabKey);
      Serial.println("about to hit return");
      Keyboard.press(returnKey);
      Keyboard.end();
    }
    //if the user was on page 3 previously:
    if(currentPage == 3) {
      Serial.println("about to hit tab 6x");
      Keyboard.begin();
      Keyboard.press(tabKey);
      Keyboard.press(tabKey);
      Keyboard.press(tabKey);
      Keyboard.press(tabKey);
      Keyboard.press(tabKey);
      Keyboard.press(tabKey);
      Serial.println("about to hit return");
      Keyboard.press(returnKey);
      Keyboard.end();
    }
    // set the current page to page 1
    currentPage = 1;
  }

Anybody know why it's not working? Thank you!
38  Topics / E-Textiles and Craft / Specs/schematic sheet for Flora? on: February 14, 2013, 01:26:30 pm
Hey y'all, I've been looking for a schematic and specs sheet for the recently-released Flora. I looked for the sheet on the page where you can order it, and it doesn't seem to be there: http://www.adafruit.com/products/659
Anybody know where/if I can find it?
39  Using Arduino / Audio / Re: processing beads library on: December 03, 2012, 03:00:53 am
Yes. Sorry for not being clear!
40  Using Arduino / Audio / processing beads library on: December 03, 2012, 01:30:34 am
Hello,

I have a program I'm working on that uses the Beads library to sample songs and change the rate at which they're played (this is done using a potentiometer—I'm sending data in from an Arduino to control the rate).

In this program, the sound clip is established in the void setup() function.

However, I would like to be able to change the song sample dynamically, in void draw(), depending on what data the program is receiving. I have five different songs, and I want the Processing program to play a different song, depending on whether the values it's receiving are between 1-100, 101-200, 201-300, 301-400, or 401-500.

Here is my code so far:


Code:
import processing.serial.*;

Serial port;

float derp = 0;

// Sampling_03.pde

// this is a more complex sampler
// clicking somewhere on the window initiates sample playback
// moving the mouse controls the playback rate

import beads.*;

AudioContext ac;

SamplePlayer sp1;

// we can run both SamplePlayers through the same Gain
Gain sampleGain;
Glide gainValue;

Glide rateValue;

void setup()
{
  size(800, 600);

  port = new Serial(this, "/dev/tty.usbmodem411", 9600);
  port.bufferUntil('\n');

  ac = new AudioContext(); // create our AudioContext

    // whenever we load a file, we need to enclose the code in a Try/Catch block
  // Try/Catch blocks will inform us if the file can't be found
  try { 
    // initialize the SamplePlayer
    sp1 = new SamplePlayer(ac, new Sample(sketchPath("") + "prelude_no_8.mp3"));
  }
  catch(Exception e)
  {
    // if there is an error, show an error message (at the bottom of the processing window)
    println("Exception while attempting to load sample!");
    e.printStackTrace(); // then print a technical description of the error
    exit(); // and exit the program
  }

  // note that we want to play the sample multiple times
  sp1.setKillOnEnd(false);

  rateValue = new Glide(ac, 1, 30); // initialize our rateValue Glide object
  sp1.setRate(rateValue); // connect it to the SamplePlayer

  // as usual, we create a gain that will control the volume of our sample player
  gainValue = new Glide(ac, 0.0, 30);
  sampleGain = new Gain(ac, 1, gainValue);
  sampleGain.addInput(sp1);

  ac.out.addInput(sampleGain); // connect the Gain to the AudioContext

  ac.start(); // begin audio processing

  background(0); // set the background to black
  stroke(255);
  line(width/2, 0, width/2, height); // draw a line in the middle
  text("Click to begin playback.", 100, 100); // tell the user what to do!
  text("Move the mouse to control playback speed.", 100, 120); // tell the user what to do!
}

// although we're not drawing to the screen, we need to have a draw function
// in order to wait for mousePressed events
void draw()
{
 
  float halfWidth = width / 2.0;

  gainValue.setValue((float)mouseY / (float)height); // set the gain based on mouse position along the Y-axis
  rateValue.setValue(((float)derp - halfWidth)/halfWidth); // set the rate based on mouse position along the X-axis

  print("gain:");
  println((float)mouseY / (float)height);
  print("rate:");
  println(((float)derp - halfWidth)/halfWidth);
  print("derp:");
  println(derp);
}

// this routine is called whenever a mouse button is pressed on the Processing sketch
void mousePressed()
{
  // if the left mouse button is clicked, then play the sound
  if( mouseX > width / 2.0 )
  {
    sp1.setPosition(000); // set the start position to the beginning
    sp1.start(); // play the audio file
  }
  // if the right mouse button is clicked, then play the bass drum sample backwards
  else
  {
    sp1.setToEnd(); // set the start position to the end of the file
    sp1.start(); // play the file in reverse (rate set in the draw routine)
  }
}

void serialEvent (Serial port)
{
  derp = float(port.readStringUntil('\n'));
}

Any help would be largely appreciated! Thank you!
41  Using Arduino / Programming Questions / Re: connecting to a webpage on: November 21, 2012, 02:50:33 am
Quote
You use client code instead of server code to send a get request to the server.

zoomkat, could you please elaborate? Thanks.
42  Using Arduino / Programming Questions / connecting to a webpage on: November 21, 2012, 01:42:23 am
Hello all,

I hope I'm posting this in the right part of the forum. I know that Ethernet shields allow you to control an Arduino from a webpage, but I'm looking to do the opposite—control some dynamic jQuery and CSS content via an Arduino. Do any of you know if this is possible with an Arduino shield? If not, then how do I connect to this webpage? If it is possible, then how do I get started?

Thanks!
43  Using Arduino / Project Guidance / Elektrobiblioteka on: November 21, 2012, 01:05:38 am
Hello all,

I'm working on making a book that uses electrically conductive media, and I'm sort of modeling it after this one:

I was wondering, would any of you happen to know—or be able to make a very educated guess at—how the arduino program knows which page the user is currently on?

Thanks!
44  Using Arduino / Installation & Troubleshooting / Re: I keep getting this odd message whenever I try to upload to my Arduino Mega 2560 on: May 02, 2012, 03:44:10 pm
Do you think there is a chance I shorted that part of the board somehow?
45  Using Arduino / Installation & Troubleshooting / Re: I keep getting this odd message whenever I try to upload to my Arduino Mega 2560 on: May 02, 2012, 03:43:22 pm
I tried connecting an LED to various pins and uploading the Blink program. It worked fine for pins 13 and 8, but when I tried pins 22, 23, and 24, it didn't work. 22 and 23 were always high, no matter what, and 24 was always low.
Pages: 1 2 [3] 4 5 ... 11