Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
makomk
Jul 16, 2011

Martytoof posted:

I guess my biggest question is whether there is any difference between an Arduino sketch compiled into .hex and uploaded or a .c file compiled to .hex and uploaded. My speculation is that there probably isn't, and the CPU will execute just fine, I just wanted to be sure before I ordered a few chips.
For the record, there are no differences whatsover in terms of programming the actual .hex file to the AVR chip. Behind the scenes the Arduino IDE just compiles everything with avr-gcc and runs avrdude to upload it, and it doesn't use any particularly special options to do so either.

Though to be fair, a standalone USBasp programmer is really absurdly cheap if it supports the AVR you're using...

Adbot
ADBOT LOVES YOU

makomk
Jul 16, 2011

Bad Munki posted:

It bears pointing out one other potential bonus for using switch statements that if() statements don't do as well, and many people forget: you don't have to use a break after each switch case. If you don't, it'll keep executing the other options until the switch is over or a break is hit.
Note that if you do this it's traditional to leave a comment pointing it out like so:

code:
int j = 0;
switch(n) {
  case 4:
    j++;
    /*fallthrough*/
  case 3:
    j++;
    /*fallthrough*/
  case 2:
    j++;
    /*fallthrough*/
  case 1:
    j++;
}
Otherwise it's very easy not to notice that there isn't a break - especially if only one or two cases from a complex switch statement don't have them - and even if you do, will you be able to remember whether it was intentional a few months down the line if you come back to the project? Trust me, Future-You will thank you for it.

makomk
Jul 16, 2011
You're probably best off buying a cheap receiver module, which means you won't have to worry about the antenna since most of the 2.4 GHz ones have one integrated onto the PCB. The first step is probably to figure out what transmitter chip the controller is using and that'll dictate what you can use to receive it; different chips support different modulations, channels, etc and they're not usually compatible with each other.

e: if you're talking controllers for RC aircraft and the like, apparently some of them use custom chips, encryption, frequency hopping, all sorts of fun stuff. Good luck with that! Sounds like they're more secure than a lot of the 2.4 GHz keyboards out there; fear of cloning by cheap Chinese manufacturers is a much better motivation than your customers getting their credit card details stolen :rolleyes:

makomk fucked around with this message at 18:02 on May 7, 2013

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply