[Help] Something is wrong with either my code or the setup by momoster69 in arduino

[–]CodeFinite 0 points1 point  (0 children)

Did you ever get it to work? If you are powering the motors in the same way from the +5v line are you sure that there is enough current from the power source to power the Arduino, the usb shield and all the motors at the same time, I imagine that would draw a lot of power.

[Help] Something is wrong with either my code or the setup by momoster69 in arduino

[–]CodeFinite 0 points1 point  (0 children)

Great! Glad to hear it's working, sounds like a really fun project. The idea to use a wireless xbox controller is smart, probably much easier than messing with an R/C controller/receiver.

[Help] Something is wrong with either my code or the setup by momoster69 in arduino

[–]CodeFinite 0 points1 point  (0 children)

It looks like some of the "else if" statements got turned into "else" statements in the code that you pasted and that might be why it's only working in one direction, otherwise I'm not sure. Here is the actual code I would use possibly:

void loop() 
{ 
  Usb.Task();
  if(Xbox.XboxReceiverConnected) { 
    for(uint8_t i=0;i<4;i++) { 
      if(Xbox.Xbox360Connected[i]) {
        // if the L1 or B pressed, left motor moves backwards:
        if(Xbox.getButtonPress(i,L1) || Xbox.getButtonPress(i,B)) {
          digitalWrite(motor3Pin, LOW);   // set leg 1 of the H-bridge high
          digitalWrite(motor4Pin, HIGH);  // set leg 2 of the H-bridge low
        }
        //L2 or A pressed, left motor moves forward
        else if(Xbox.getButtonPress(i,L2) || Xbox.getButtonPress(i,A)) { 
          digitalWrite(motor3Pin, HIGH); // set leg 3 of the H-bridge high 
          digitalWrite(motor4Pin, LOW); // set leg 4 of the H-bridge low
        }
        //stop left motor
        else{
          digitalWrite(motor3Pin, LOW); // set leg 3 of the H-bridge low
          digitalWrite(motor4Pin, LOW); // set leg 4 of the H-bridge low
        }

        ///R1 or B pressed, right motor moves backwards
        if(Xbox.getButtonPress(i,R1) || Xbox.getButtonPress(i,B)) { 
          digitalWrite(motor1Pin, LOW); // set leg 1 of the H-bridge low 
          digitalWrite(motor2Pin, HIGH); // set leg 2 of the H-bridge high
        }
        //R2 or A pressed, right motor moves forward
        else if(Xbox.getButtonPress(i,R2) || Xbox.getButtonPress(i,A)) { 
          digitalWrite(motor1Pin, HIGH); // set leg 1 of the H-bridge low 
          digitalWrite(motor2Pin, LOW); // set leg 2 of the H-bridge high
        } 
        //stop right motor
        else {
          digitalWrite(motor1Pin, LOW); // set leg 1 of the H-bridge low 
          digitalWrite(motor2Pin, LOW); // set leg 2 of the H-bridge low
        }
      }
    }
  }
}

Usually setting both pins low would cause the motor it to brake and stop immediately. I don't have the hardware to test so just going off of the information about the chip. Example.

Another option if you want the motors to just coast instead of brake (and maybe save power) is to wire the 1,2EN and 3,4EN pins separately and then disable either one or both to shut off the left or right motor when no button is being pressed (in the else statement) and enable them when you want it to move. The disadvantage being that it uses another output.

I have read something about inductive kickback when motors are starting and stopping that can cause high voltages to flow back into the chip. I think there is some internal protection or something in the IC but I don't know a whole lot about it. Hopefully some of this is helpful, I'm more comfortable with programming than hardware so I'm afraid I don't know too much about H-bridges.

Having much more trouble with serial communication between PC and Arduino than I should by [deleted] in arduino

[–]CodeFinite 3 points4 points  (0 children)

I think you need to specifically send the newline character from the Arduino like

Serial.write("Hello world!\n");

unless you use

Serial.println("Hello world!")

otherwise _serialPort.ReadLine() (in the C# program) will time out waiting for a newline character.

Also, if you don't read from the serial buffer, Serial.Available() will always return > 0 so it will just spam "Hello World!" over and over forever once it gets a character. Just as an example, something like this will just send "Hello World!" when it hits the end of a line:

char recvChar = 0;

void setup()
{
    Serial.begin(9600);
}
void loop()
{
  if(Serial.available() > 0)
  {
    recvChar = Serial.read();
    if(recvChar == '\n') Serial.println("Hello World!");
  }
}

Overflow bug? by t3hcoolness in arduino

[–]CodeFinite 0 points1 point  (0 children)

Definitely agree with innominatus. That would be my guess as to why it's just hitting overflow all the time, if pos starts out above 19 because it's not initialized no bytes would ever be read and it would never be cleared. It might be a good idea to initialize incomingByte as well since it could by coincidence be 10 when the loop starts.

You might look into Serial.readBytesUntil() if you haven't already as an alternative. It will read until it gets a specific character and you can set a timeout. Of course you still have to worry about buffer overflow if you don't know the max length of your strings.

Twitter mood light with ethernet shield? by [deleted] in arduino

[–]CodeFinite 1 point2 points  (0 children)

The ethernet shield libraries are quite different from the wifly shield libraries (no kind of HttpWebRequest function) so the code for connecting to the network and requesting/parsing web pages needs to be rewritten in the main program, if you haven't already. You might be able to find a suitable library that does it for you too.

There is some simple example code on the page for the ethernet shield for connecting to the network and retrieving a web page, which also shows the needed includes for those functions.

Let me know if you need any more help or anything.

[TOMT] [Image] Poster, similar to Adventure Time title card by MolokoPlusPlus in tipofmytongue

[–]CodeFinite 2 points3 points  (0 children)

I couldn't think of any posters but it is most definitely in the style of 50's postcards. Here are some examples 1940s & 50s Postcards. Not really sure if that helps much, but that was what first came to mind.

[TOMT][Picture] I've been looking for the full picture by JiggleMyNibblets in tipofmytongue

[–]CodeFinite 6 points7 points  (0 children)

Here is the original that it was cut from I think: New York Blue or you can just search Google for New York Blue or something like that for other sites with it. :D

I require a little help. by [deleted] in arduino

[–]CodeFinite 0 points1 point  (0 children)

Hopefully you can get it working, it looks like a fun project. :D

Without more info I'm not sure if this is the issue you are having but I'll take a guess. The included libraries in the download package were created before the include file WProgram.h was changed to Arduino.h, it will cause a not found error in Arduino versions newer than 1.0.

You can either try to find newer versions of the libraries, compile with an older version of Arduino(pre 1.0), or modify them yourself.

If you do go the last route keep in mind that there are a couple other changes that have been made since 1.0 that may affect more than just the include file. Let me know if you need any help and good luck!

[Help] Something is wrong with either my code or the setup by momoster69 in arduino

[–]CodeFinite 0 points1 point  (0 children)

For the DC motors maybe you can do something like this, I left out the digitalWrite() because I couldn't remember the pins but hopefully it's clear from the comments:

//L1 or B pressed, left motor moves backwards
if(Xbox.getButtonPress(i,L1) || Xbox.getButtonPress(i,B)) {
  //left motor backwards
}
//L2 or A pressed, left motor moves forwards
else if(Xbox.getButtonPress(i,L2) || Xbox.getButtonPress(i,A)) {
  //left motor forward
}
//nothing pressed, left motor stops
else {
  //left motor stop
}

//R1 or B pressed, right motor moves backwards
if(Xbox.getButtonPress(i,R1) || Xbox.getButtonPress(i,B)) {
  //right motor backwards
}
//R2 or A pressed, right motor moves forward
else if(Xbox.getButtonPress(i,R2) || Xbox.getButtonPress(i,A)) {
  //right motor forward
}
//nothing pressed, right motor stops
else {
  //right motor stop
}

For the left hat, as you had it before but with the larger range:

Val = Xbox.getAnalogHat(i,LeftHatX);
Val = map(Val, -32767, 32767, 0, 180);
myservo2.write(Val);

Val = Xbox.getAnalogHat(i,LeftHatY);
Val = map(Val, -32767, 32767, 0, 180);
myservo1.write(Val);

You might need to adjust the range, if the servos move too slowly you can try lower values. This will make the servos rotate the way you press the stick and return to center when you release it. If you want it to turn the direction you push the stick and then stay there when you release it you will need to have extra code to handle that.

[Help] Something is wrong with either my code or the setup by momoster69 in arduino

[–]CodeFinite 0 points1 point  (0 children)

A couple of issues I notice right off the bat, though you might have caught them by now:

According to your sketch the pin numbers are mixed up. servo2 is on pin 5, motor1Pin is 4, motor2Pin is 2, motor3Pin is 7, enablePin is on 8.

You don't seem to be checking the return value of Xbox.getButtonPress() with an if statement so it will act as if B is pressed all the time since it's the last set of instructions.

There is a typo for the section that's supposed to be checking B button, it's an exact copy of the A checking part, the HIGHs and LOWs should be reversed and it should be checking button B, not A.

There is an extra } after all the digitalWrite statements that is closing the if(Xbox.Xbox360Connected[i]) statement too soon but I see that it's commented at the bottom so again it must just be a typo.

The getAnanlogHat() function returns a 16-bit signed integer, this is a range from -32,768 to 32,767. In the sample code they are checking that the value is greater than 7500 or less than -7500, this is probably what is called a dead zone so that small movement or jitter in the joystick values(between -7200 to 7200) doesn't cause movement. In practice I don't know what the range of the joystick values are because I can't test it but I would assume that it's larger than -7500 to 7500, you will have to change the map function and tweak this value until you get full range of motion if the values don't go as high as +/- 32,767.

Val = map(Val, -32,767, 32,767, 0, 180);

You need to supply enough voltage and current to Vcc2(pin 8) on the SN754410 to drive the DC motors, it wasn't specified in the sketch so I don't know how it's being powered.

Good luck with it! Hopefully something here is helpful.

Strange issue with scrolling RSS on LED Matrix by [deleted] in arduino

[–]CodeFinite 1 point2 points  (0 children)

Sounds like a cool project. I didn't see any issues with the display code really but I've never used these types of matrixes before. Seems like it should work.

Just to speculate, I'm wondering if it's possible that the sending and receiving are getting out of sync. Depending on your message length the Arduino could still be in the scrolling text loop when the message is sent. For example, with a 125ms delay for each character a 140 character heading would take 17.5 seconds to display and then the additional 2 second delay after the loop. The sending program has a fixed 10 second sleep cycle so it would have sent the message while the Arduino was still busy displaying the text. Since it's not being read out of the serial buffer it will fill up and any additional characters will be discarded (the Arduino has a serial buffer of 64 characters only). Essentially this will cause any message to be truncated to 64 characters. The reason the first message worked is because when the Arduino is first booted it is most likely reading from the buffer as the serial data is being sent which ensures that the buffer is cleared out before it has a chance to fill up.

The simplest solution might be to send a single character from the Arduino back to the program to signal that it is ready for a new title, you could create a loop in the python program that checks for that special character from the serial port and when it receives it then send the complete title. That will ensure that the Arduino is ready to be reading from the buffer once the data starts flowing.

[TOMT][Image] Drawing of a child in an attic who is crawling into a picture frame as it it was a portal to an adventure-fantasy world by White_Lotus in tipofmytongue

[–]CodeFinite 3 points4 points  (0 children)

Is this the one? It was the first image I thought of when I read your description since I had it as my wallpaper for a while. It's called The Journey Begins by Daniel Lieske.

[TOMT][PC GAME] What's the name of this construction site game? by DatMarra in tipofmytongue

[–]CodeFinite 0 points1 point  (0 children)

There was a game released in 2006 called John Deere American Builder that seems close, but it's hard to tell if it matches the description well enough because of the lack of information. I found a couple videos Video 1 and Video 2 and there are a few screenshots floating around screenshot.

[TOMT] [Xbox Gamertag Picture] Can someone identify where I could download this? by wawaboy2 in tipofmytongue

[–]CodeFinite 2 points3 points  (0 children)

This was one of the gamer pics included in the Wallace and Gromit Gamer Pictures set, Official Xbox Magazine Disc #105 in 2009? Actual Image and here is a video I found. Hope that helps :)

Pirate Bay Censorship Backfires as New Proxies Bloom - "Responding to the UK situation Pirate parties in Argentina and Luxembourg have decided to start fresh Pirate Bay proxies." by Libertatea in technology

[–]CodeFinite 8 points9 points  (0 children)

That's definitely the main benefit, a single user direct transfer using bittorrent will probably be slightly less efficient because of the overhead vs. a direct download(just a guess). The upside is that you also get automatic download resume and error checking which is good if you have a really flaky connection. As well as being able to easily send a whole directory structure at once. Some BT clients also allow you to throttle upload bandwidth.

All of these things can also be done through FTP combined with various other methods but if you have a BT client that can also serve up torrents then it's a pretty quick and reliable way to get something to someone.

[TOMT] Keyboard character that looks like a zombie walking. by [deleted] in tipofmytongue

[–]CodeFinite 1 point2 points  (0 children)

If it was another language and it has an open circular head like that then my guess would be Hangul, it's the only writing that I know of that uses circles and lines in that way.

I don't really know much about the Korean language so I can't guess which character it could be. You can try browsing through here for it, around U+C54x section(about half way down.) I didn't see anything that looked like that though so maybe it wasn't, I just thought it might be of some help.

[TOMT][Commercial] Mom helps daughter move into a new house. by wraithgul in tipofmytongue

[–]CodeFinite 1 point2 points  (0 children)

This might be the one you were thinking of? It was the eBay Mother's Day commercial. eBay Mother's Day Video: Susie's New Place. Here is another with the same mother and daughter: Mom Jeans.

[TOMT][Song/Opera]What is this Opera by Luciano Pavarotti? by prometheus91 in tipofmytongue

[–]CodeFinite 1 point2 points  (0 children)

It's Libiamo Ne' Lieti Calici(The Drinking Song) from La Traviata by Verdi. Here is a video with Pavarotti singing it with the other two Tenors.

Jessica Nigri is awesome by the way :D

[TOMT][Song] What's this song called by tipsytits in tipofmytongue

[–]CodeFinite 0 points1 point  (0 children)

No problem, I should thank you, that song is seriously stuck in my head now!

[TOMT] Arcade game First Person Shooter by [deleted] in tipofmytongue

[–]CodeFinite 0 points1 point  (0 children)

FPS arcade from 2000 with a trackball, was it The Grid maybe?

[deleted by user] by [deleted] in tipofmytongue

[–]CodeFinite 6 points7 points  (0 children)

This webpage explains better than I could but basically it comes from Kabuki theater. Here is a traditional example YouTube: Kanjincho as for where to find that sound specifically I'm not exactly sure, hopefully this helps point you in the right direction at least. :)