# Adafruit Monster M4sk eye rotation



## Daphne (Oct 18, 2006)

Has anyone purchased the monster M4sk and successfully gotten the eyes to rotate so you can use the screens in a different configuration? I can get the eyes to work and have been able to change various attributes such as removing the eyelids or making the iris's spin but can't get the rotate command for the eyes to work. I've tried it inside the left and right keyword sections as well as outside the left/right curly brackets which should rotate them both in the same direction. None of it worked. 

I need to break the mask apart at the nose since it won't work in my sculpt as is but I am not removing the nose until I fix this issue first. The fewer the variables the better. 

I've posted several times on the Adafruit forums but so far no one has been able to figure out whats going on other than saying its a software issue. Anyone else have this problem? Thanks.


----------



## corey872 (Jan 10, 2010)

Hopefully someone with experience will come along. Until then, the usual reply for all such issues is "post your code" (ideally wrapped in 'code' tags - click the "#" symbol in the 'reply to thread' window header)


```
So its easier to read like this
```
.

A few other possibilities:

A quick look at the adafruit website shows the command is 'rotate' - which in that programming language is different from 'Rotate' or 'ROTATE' - so be sure to use the proper capitalization (ie - none, in this case). The acceptable value is 0 - 3 (presumably 90º rotation for each increment?) so also be sure you haven't typed an 'out of range' value. Believe any new line typically needs a ";" at the end - that's the part i usually forget!

Hope this helps.


----------



## Batbuddy (Sep 3, 2014)

Yes Daphne, Post your code and I can see what I can do. I don't have the Monster mask, but i did look at it and was thinking of trying it out... I am not a super good code guy, but I have done a fair bit of Arduino coding the last few years.


----------



## Daphne (Oct 18, 2006)

Thanks to both of you for responding. The M4sk is really cool other than this issue. Still no clue why they spell it with a 4 but I digress... Anyway, the rotation problem is driving me nuts and with the USB cord sticking out of the top of one eye, it is never going to fit in the sculpt without rotating it.

The maddening thing is the syntax is correct according to Adafruit. Back in the day I was actually a programmer. I have experimented with using bad syntax and crazy numbers to validate my changes were being read and it choked. They were and it did. I can do other things like kill the eyelids and make the iris's spin just not the rotate.

To get help from Adafruit you have to post on their forums. They have validated the code is correct but can't figure out the problem either. Here is the thread with everything I've tried: (hope its ok to post this)

https://forums.adafruit.com/viewtopic.php?f=59&t=160552&p=791336#p791336

And here is the current code below. JSON doesn't require semicolons although it is picky about commas. When rotate was ignored inside the left/right sections they suggested I move the command outside to do a wholesale change to both eyes simultaneously. No success there either. I've never touched Arduino code and know zip about it. I don't seem real proficient with JSON either ha ha. The only thing I added was the rotate and irisSpin but the irisSpin is currently commented out. Please forgive me, I don't see where to insert the code as code.

{
"boopThreshold" : 17500, // lower = more sensitive
"eyeRadius" : 125,
"eyelidIndex" : "0x00", // From table: learn.adafruit.com/assets/61921
"pupilColor" : [ 0, 0, 0 ],
"backColor" : [ 140, 40, 20 ],
"irisTexture" : "hazel/iris.bmp",
"scleraTexture" : "hazel/sclera.bmp",
"upperEyelid" : "hazel/upper.bmp",
"lowerEyelid" : "hazel/lower.bmp",
"rotate" : 1,
"left" : {
//"irisSpin":80
},
"right" : {
}
}


----------



## Batbuddy (Sep 3, 2014)

Daphne said:


> Thanks to both of you for responding. The M4sk is really cool other than this issue. Still no clue why they spell it with a 4 but I digress... Anyway, the rotation problem is driving me nuts and with the USB cord sticking out of the top of one eye, it is never going to fit in the sculpt without rotating it.


 Daphne, I downloaded the source code for this project and opened it in the Arduino IDE. I imagine there must be an issue with the json file, but I can't see one. Have you tried using rotate with different numbers, say 2 or 0? As I read through the Adafruit documentation it looks like a 90 degree rotation would be 2 or 0. The default is 3. If it were me I would modify the rotation in the Arduino code default settings as it is way easier to ensure accuracy there and just use the json file to modify the graphic stuff that is working. It sounds like a bit of a hassle to upload modified firmware, but it would be waaay easier of a solution. I guess my 2 bit advice is to first try the following json file, then if that doesn't work try modifying the rotation default in the Firmware(arduino .ino file).

```
{
"boopThreshold" : 17500, // lower = more sensitive
"eyeRadius" : 125,
"eyelidIndex" : "0x00", // From table: learn.adafruit.com/assets/61921
"pupilColor" : [ 0, 0, 0 ],
"backColor" : [ 140, 40, 20 ],
"irisTexture" : "hazel/iris.bmp",
"scleraTexture" : "hazel/sclera.bmp",
"upperEyelid" : "hazel/upper.bmp",
"lowerEyelid" : "hazel/lower.bmp",
"rotate" : 2,
"left" : {
},
"right" : {
}
}
```


----------



## corey872 (Jan 10, 2010)

[edit - def. try Batbuddy's suggestions first - looks like he replied while I was typing!] ...but FWIW...

Don't see anything specifically wrong with the code as written.

The documentation seems to suggest the 'rotate' would go in the left / right sections - but believe you mentioned you tried that?

https://cdn-learn.adafruit.com/downloads/pdf/adafruit-monster-m4sk-eyes.pdf



> Screen orientation is specified with the rotate keyword, with a value from 0 to 3 (default is 3). This can be helpful if you've split your MONSTER M4SK in two. Sometimes the mask-halves will fit into a project better if they're each turned 90 degrees, and this setting compensates so the eyes are right-side-up again. You can put separate rotate values in the left and right sections...try 0 and 2 (or 2 and 0, depending which way the eyes are turned).


A few other random / grasping straws thoughts:

Guess there is nothing 'magic' about physically splitting the mask - ie no specific setting or jumper which tells the firmware the mask is 'split' which might enable the rotate command?

Do you have the correct and latest firmware? The documentation mentions rotate has no effect on the "one eye" version. Though I suppose 'wrong firmware' would cause a host of other problems.

Guess there are notable features (eyelids?) on the eye which would definitely confirm it's rotated? ...possibly it wouldn't be clear anything rotated just looking at a round eye ball?

Looks like there is an on-board accelerometer (p 60) - don't suppose that interacts with the rotate in any way? ie sensing 'down' or that the board is already rotated to some angle?

Thus concludes my random wild guessing!


----------



## Batbuddy (Sep 3, 2014)

Corey makes a good point. Maybe the code should be:

```
{
"boopThreshold" : 17500, // lower = more sensitive
"eyeRadius" : 125,
"eyelidIndex" : "0x00", // From table: learn.adafruit.com/assets/61921
"pupilColor" : [ 0, 0, 0 ],
"backColor" : [ 140, 40, 20 ],
"irisTexture" : "hazel/iris.bmp",
"scleraTexture" : "hazel/sclera.bmp",
"upperEyelid" : "hazel/upper.bmp",
"lowerEyelid" : "hazel/lower.bmp", 
 "left" : {"rotate" : 2,
 },
 "right" : {"rotate" : 0, 
 } 
}
```


----------



## Daphne (Oct 18, 2006)

Thanks so much to you both for your continued help.

Initially, I tried rotate inside the left and right sections. Nothing happened. Adafruit recommended I pull rotate out which would affect both eyes simultaneously. Nothing happened. I tried values of 0, 1, 2, as well as numbers completely out of range like 7 and 8 both inside and outside the right/left sections. Unfortunately, nothing happened on any values. The command is apparently being ignored so I didn't actually expect it to choke on the out of range ones. You can't put a comma at the end of the rotate inside the left and right sections. It does choke on that so at least it validates the syntax inside the brackets even if it doesn't care what the command is.

The only instance I've seen of it working at all is in the Cappy example. (Warning: you will NEVER get that music out of your head!) https://learn.adafruit.com/cappy-monster-m4sk/overview Look at the eyes at 45 seconds on the video. Why they rotated the eyes when they were pulling off the eyelids is beyond me but the mask is still together and they are rotated upside down. I don't know how you could tell it was rotated without the eyelids since they follow the eye hence my confusion why it was in the video but there was a brief moment there that it was clear it worked.

I believe I have the latest firmware but I'll see if I can reload it and see if that makes any difference. I wouldn't think the Cyclops version firmware would work since there is only one eye. The frustrating part is it worked right out of the box and went beautifully right up until the rotate situation.

I'm not sure how to access the Arduino code to modify it directly. I'll see if I can figure that out as well.

Thanks again!! You two are the best!


----------



## Daphne (Oct 18, 2006)

Corey872 and Batbuddy, you two are absolute rockstars!!! I was convinced, 100% I had the latest firmware and did it all correctly. I, kind sirs, am an idiot. I just went back and read the guide for probably the 10th time and figured what the heck, I know I have the latest firmware but maybe I messed it up and don't. Guess what, I messed it up somehow and while I am not sure what I did with the latest firmware file, it didn't get loaded on the mask. User error at its finest. As soon as I pulled the newest firmware on the mask, clearly for the first time, not what I assumed was the second it worked like a dream. Weirdly enough, if you put a bogus value, I used 7, it just appears to assume you are stupid and goes to default on the eye with the bogus value, the other was rotated with a legit value.

I can't believe how many hours I wasted on what was a stupid mistake on my part. It is a great product, as long as you can read, and I now get to go on their forum and tell them I clearly am unable to follow instructions...

Thanks for your support, suggestions and getting me to redo what I thought I had done again, this time, correctly. You are both wonderful.  Thank you.


----------



## corey872 (Jan 10, 2010)

Yay!! Glad you got it working. Don't be too hard on yourself - I'm sure I've spent way more time on way more simple issues that just escaped my perception at the time! Plus, would have been nice if they would have made the thing at least flash a screen with firmware version, parameters, etc on start up!


----------



## Batbuddy (Sep 3, 2014)

Yay! I am glad you got it to work as well. If you ever need help with Arduino software let me know and i can walk you through it. It pretty easy...


----------



## Daphne (Oct 18, 2006)

Amen on info on the startup. Typically when I can't figure something out I will walk away and take a break and it usually hits me what the issue is. This time I made assumptions and that rarely works out well ha ha! 

I was able to change the eyelid color tonight and plan to split the mask and hopefully attach it to my witch this weekend. Fingers crossed!


----------



## Batbuddy (Sep 3, 2014)

Looking forward to seeing a pic or video of the witch working


----------



## Daphne (Oct 18, 2006)

I managed to delete this section when I posted and just realized it...

Thanks for the offer Batbuddy. I'm contemplating adding eyelids that blink to a Dalen rotating head owl that I want to turn into an animatronic. At this point, I haven't decided if servos or a reindeer motor makes more sense so you may live to regret that offer ha ha! 

I'm looking forward to the witch being done too and I'll definitely post a pic or video. Wish I was getting paid to build this particular prop....


----------



## Batbuddy (Sep 3, 2014)

I am always happy to help, that owl sounds cool! Let me know...


----------

