Main Site Documentation

Wii nunchuck


#1
NumChuckInitializeTrans[0] = NumChuckDevice.CreateWriteTransaction(new byte[] { 0x40, 0x00 });

Gives error:

Help? :whistle:


#2

You are a FEZ master, you should’t ask simple question like that :frowning:
I refuse to answer :o


#3

Hahaha good thing you refused Gus, I should not start coding without my second cup of coffee ???

Thanks :smiley:


#4

I would suggest a malus of 600 exp points :smiley:


#5

I would suggest a FEZ coffee machine :smiley:


#6

I don’t think this is a bad question. This is changed in v4.1 so you are getting an error. But the error tells you how to solve it.
You cannot use reference: NumChuck.Create…
Use the typename: I2CDevice.Create…
We need to update our drivers.


#7

Try the new driver online.


#8

Good work Mike! I was planning to upload it this afternoon, but you were quicker :smiley:

Why was it changed anyway?
Thanks!


#9

Is there a reason why the values are not stable? The output below shows the data transferred back after press (and hold) up and press (and hold) down.

Why don’t the values stay stable?


#10

They look alright to me…

You might need to implement a filter of some sort…


#11

No they are not alright. Because (as far as I believe) the numbers should stay at -77 or 132 and not switching back to 51 in between :stuck_out_tongue:


#12

No that is normal, you will never see perfect numbers in analog and if there is a problem in fact then it is inside your controller not in FEZ.
FEZ reads digital numbers so there is no error on FEZ.


#13

Well, I understand that. But why are the numbers not stable with the controller?
Is there a way to fix this?


#14

Ask the manufacture who made it :slight_smile:

You can make a filter to help in making the numbers more sable


#15

Hello mister manufacturer! Why is your product not working with FEZ! it should!! FEZ is awesome! :stuck_out_tongue:

What do you mean by “filter” ? how do I filter the data? Do you have an example?


#16

Actually, like I explained before, this has NOTHING to do with FEZ. If you use FEZ or anything else, you will get he same EXACT results.

Digital filters…this can be very complex but for our purpose, it is really simple.

average the last 5 samples received and you will get much better results

  1. read 5 samples
  2. add them up
  3. divide by 5
  4. you have an averaged number

you can use the media instead of using average but then you have to sort so just try to average fro now.


#17

Sorry to say, Gus,

but i think In this case i think an average model is here not working. The values are so far apart that the average will give to much vibrations to the real value.

My suggestion should be the just ignore any value that is not within a certain margin.

my idea is something like this:


  int lastvalue;
  int currentvalue;
  int margin = 5;
  void function testnewvalue(int newvalue) 
{
  if (newvalue > lastvalue - margin &&  newvalue < lastvalue + margin) 
  {
      currentvalue = newvalue;
  }
  lastvalue = (lastvalue + newvalue) / 2;
}

For the calculation of lastvalue you can use gus’s average model to get a more smooth control.

suc7

Niels


#18

I believe you should re-read my joke. This had nothing to do with the fact that FEZ was the cause.
I know that FEZ is not the cause. :wink:

But, I am not really clear of the fact how this would result in different values.
Because, 77 is full forward. Everything between 51(centre) and 77(full forward) is still forward.

So if I’m right the values would be:

Minimum: (51,51,51,51,52): 51.2
Maximum: (77,77,77,77,77): 77

and anything in between would be forward…?

EDIT: Niels, I believe your approach is clear to me and should make it work. I will check it out later on.

Thanks both of you! :slight_smile:


#19

I would agree with Niels answer. This is simple filtering but effective.
You just have to know if big variations are useful/meaningful or not for you. I mean if you can ignore them or not.


#20

[quote]I would agree with Niels answer. This is simple filtering but effective.
You just have to know if big variations are useful/meaningful or not for you. I mean if you can ignore them or not.[/quote]

I do not know if you have seen my video:
http://www.youtube.com/watch?v=7VB_0ooikQs

But, I would like to do the same with the nunchuck as with the joystick.
So, as long as I press (and hold) forward, I would like to have a forward command and thus driving the robot forward.

As long as this number is not stable, the robot would start acting strange (forward, stop, forward, stop…)

I believe niels’ approach might be the right one. I can’t wait to check it out.