Show Posts
Pages: 1 [2] 3 4 ... 9
16  Using Arduino / Programming Questions / Re: int and unsigned int on: October 07, 2012, 03:39:41 pm
The unsigned int variable or delcared as a word is what i was wanting to create and works great in my main code. But because at first i had the variable "Display_RPM" delcared as just an int and seeing 32bits in the serial monitor just didn't add up. The documentation for a int value in the reference section says it's meant to be 16bits not 32bits that am seeing in the serial monitor. So because am a beginner at C++ and Arduino this was very confusing for me and thought my understanding was wrong, hence why i thought it was a silly question in the first place.

How do you report a bug?
17  Using Arduino / Programming Questions / Re: int and unsigned int on: October 07, 2012, 03:10:39 pm
Sorry Nick. Here is what i see in the serial monitor below.

unsignd int value
1111111001111111
int value
11111111111111111111111001111111
18  Using Arduino / Programming Questions / Re: int and unsigned int on: October 07, 2012, 02:22:09 pm
Here is my test code that shows in the serial monitor what am talking about, displays a int value that has 32bits and an unsigned int that has 16bits.

Code:
byte temp;
unsigned int result = 7000;
unsigned int Display_RPM_A;
int Display_RPM_B;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  
  temp = result/1000;
  Display_RPM_A = ~((1 << (16 - temp))-1) | ((1 << temp)-1);
  
  temp = result/1000;
  Display_RPM_B = ~((1 << (16 - temp))-1) | ((1 << temp)-1);
  
  Serial.println("unsigned int value");
  Serial.println(Display_RPM_A, BIN);
  
  Serial.println("int value");
  Serial.println(Display_RPM_B, BIN);
}

void loop() {
  // put your main code here, to run repeatedly:
  
}

(Changed code above because the wrong lable was being printed).
19  Using Arduino / Programming Questions / Re: int and unsigned int on: October 07, 2012, 05:09:04 am
Thank you, that explains a few different websites. So am i right in thinking in Arduino a int is 32bits long and an unsigned int is 16bits long? Well from what i can see in the serial monitor it is. Sorry for the so called dumb questions but i have never used any programing till a few months ago and am tring to learn myself Arduino and actual C++.
20  Using Arduino / Programming Questions / Re: int and unsigned int on: October 07, 2012, 04:55:48 am
Arduino reference says int 2bytes but if i look here http://www.tutorialspoint.com/cplusplus/cpp_data_types.htm an int is 4bytes.
21  Using Arduino / Programming Questions / Re: int and unsigned int on: October 07, 2012, 04:45:25 am
Ok.
22  Using Arduino / Programming Questions / int and unsigned int on: October 07, 2012, 04:17:48 am
Hello all,

This is probably a silly question but am going to ask it. I thought an int was 16bits long but when i print out a int value in the serial monitor as binary i can see 32bits. If i change the value to unsigned int i then see just 16bits. Why is this? Is it because the int type can hold a negative number but the unsigned int can't?

Thanks.
23  Community / Website and Forum / selling? on: October 06, 2012, 11:14:13 am
Hi all,

Does the forum allow posts about selling components? A section for people to sell unwanted components may not be a bad idea.
24  Using Arduino / Microcontrollers / ATmega324 on: October 05, 2012, 07:01:42 am
Hello everyone,

Sorry if this has been covered before but after googling not much info came up. Am finding that i don't have enough pins with the Arduino UNO but the Arduino MEGA is far to many so is it possible to use the ATmega324 in the same way i use the Arduino UNO with the Arduino IDE?

Thank you.
25  Using Arduino / Networking, Protocols, and Devices / Re: Trying to understand the CAT9532 i2c IC. on: October 05, 2012, 05:09:10 am
Ok thats great. Hmmm, i don't need all the blink stuff so might be better going for a basic i2c expander chip for eaiser coding.

Thanks.
26  Using Arduino / Networking, Protocols, and Devices / Trying to understand the CAT9532 i2c IC. on: October 05, 2012, 03:09:53 am
Hello all.

Am trying to understand how to use the CAT9532 IC so hope someone can help. Am i correct in thinking that you have to send 2 bits of data per i/o pin and can i send a big hex number to control all 16 i/o's in one transmission for example 0x55555555 (to turn all outputs on) or do you have to split it down to 4bytes?

http://www.onsemi.com/pub_link/Collateral/CAT9532-D.PDF

Thanks.
27  Using Arduino / General Electronics / Re: MAX7219 in the UK. on: October 02, 2012, 03:11:18 pm
In general i would like to buy from the UK but looking at this i may start buying from overseas.
28  Using Arduino / General Electronics / Re: MAX7219 in the UK. on: October 02, 2012, 03:08:16 pm
This is very silly. Tayda - 1 x MAX7219 with 7 - 16 day delivery($0.99) to the UK $2.24.
29  Using Arduino / General Electronics / Re: MAX7219 in the UK. on: October 02, 2012, 03:02:49 pm
The stupid thing about Farnells UK is that when your looking at the items it shows you items in the USA for next to nothing. But if you look at the same item in stock in the UK the price is 8 times more lol. In the UK a MAX7456 is £20 from Farnells.
30  Using Arduino / General Electronics / MAX7219 in the UK. on: October 02, 2012, 02:52:20 pm
Simple question for people that use the MAX7219 in the uk. Where is the cheapest place that you all have found for them? Farnells is £10 for 1 and that is very expensive.
Pages: 1 [2] 3 4 ... 9