// WiiFeelPixel (version: 0.1, release date: 1 may 2008) // http://www.wiifeelpixel.com // Made by iFeelPixel association // http://www.ifeelpixel.com // Hardware requirement: Nintendo Wiimote, Bluetooth dongle // Software requirement: GlovePie 0.30 (Thanks to Carl Kenner). // This script allows you to detect pixel on screen with Rumble Feedback and Sound Feedback. // It can be useful for blind computer user. // Instructions: // Use your normal mouse to control the pointer on screen or use another script to control the mouse. // Press button 1 to activate/deactivate rumble feedback // Press button 2 to activate/deactivate sound feedback // Press button A to locate your cursor vertical position on screen (Y-axis) // Press button B to locate your cursor horizontal position on screen (X-axis) // Press D-pad to select your treshold value for pixel detection // UP = 0.99 (4 leds lighted), Right = 0.75 (3 leds lighted), Left = 0.50 (2 leds lighted), Down = 0.25 (1 led lighted) // Press button Home to restore default settings (Threshold = 0.50, Volume = 25 %, etc...) // Sound Frequency is based on RGB (Red, Green, Blue) value of pixel. // You can modify the volume of the sound and the Vibes with - Minus button and + Plus button on your WiiMote // if pressed(Wiimote.Up) then Wiimote.Frequency = Wiimote.Frequency+50 // if pressed(Wiimote.Down) then Wiimote.Frequency = Wiimote.Frequency-50 if pressed(Wiimote.Minus) and Wiimote.Volume > 0% then Wiimote.Volume = Wiimote.Volume - 5% if pressed(Wiimote.Plus) and Wiimote.Volume < 100% then Wiimote.Volume = Wiimote.Volume + 5% //debug = Wiimote.Frequency+', '+Wiimote.Volume // get pixel value [var.r, var.g, var.b] = ScreenPixel(Mouse.CursorPosX, Mouse.CursorPosY) var.RGB = (var.r + var.g + var.b ) / 3 // Set threshold value to default, if all leds are light off if wiimote.Led1 = false and wiimote.Led2 = false and wiimote.Led3 = false and wiimote.Led4 = false then var.tresh = 0.50 wiimote.Led1 = true wiimote.Led2 = true wiimote.Led3 = false wiimote.Led4 = false Wiimote.Volume = 25% var.Start = true var.StartSpeaker = true var.time = 100 End if // reset settings to default if pressed(Wiimote.home) then var.tresh = 0.50 Wiimote.leds = false wiimote.Led1 = true wiimote.Led2 = true wiimote.Led3 = false wiimote.Led4 = false Wiimote.Volume = 25% var.Start = true var.StartSpeaker = true var.time = 100 End if // timer rumble var.time = Wiimote.Volume * 1000 // Locate the mouse position (coordinate X) on screen if pressed(Wiimote.B) then //midi.FirstNote = mouse.x * 127 //midi.SecondNote = mouse.y * 127 if var.StartSpeaker = true then wiimote.Frequency = (1 + mouse.x) * 1000 if var.StartSpeaker = true then wiimote.volume = Wiimote.Volume if var.Start = true then wiimote.rumble = 1 //if var.time = 0 then var.time = 100 wait var.time ms wiimote.Rumble = 0 wiimote.Frequency = 0 End if // Locate the mouse position (coordinate Y) on screen if pressed(Wiimote.A) then //midi.FirstNote = mouse.x * 127 //midi.SecondNote = mouse.y * 127 if var.StartSpeaker = true then wiimote.Frequency = (1 + mouse.y) * 1000 if var.StartSpeaker = true then wiimote.volume = Wiimote.Volume if var.Start = true then wiimote.rumble = 1 //if var.time = 0 then var.time = 100 wait var.time ms wiimote.Rumble = 0 wiimote.Frequency = 0 End if // activate/deactivate rumble if pressed(Wiimote.One) then if var.Start = true then var.Start = false Else var.Start = True End if End if // activate/deactivate speackers if pressed(Wiimote.Two) then if var.StartSpeaker = true then var.StartSpeaker = False Else var.StartSpeaker = true End if End if //choose Treshold value with d-pad //up = 4 leds, right = 3 leds, left = 2 leds, down = 1 led // this part of code is taken from Wiibrator v2.0By deceased if wiimote.Up then wiimote.Led1 = true wiimote.Led2 = true wiimote.Led3 = true wiimote.Led4 = true // var.time = 80 var.tresh = 0.99 //var.rmbl = true elseif wiimote.Right then wiimote.Led1 = true wiimote.Led2 = true wiimote.Led3 = true wiimote.Led4 = false var.tresh = 0.75 // var.time = 60 // var.rmbl = true elseif wiimote.Left then wiimote.Led1 = true wiimote.Led2 = true wiimote.Led3 = false wiimote.Led4 = false var.tresh = 0.50 // var.time = 40 // var.rmbl = true elseif wiimote.Down then wiimote.Led1 = true wiimote.Led2 = false wiimote.Led3 = false wiimote.Led4 = false var.tresh = 0.25 // var.time = 20 // var.rmbl = true endif // Pixel detection (compare RGB value with treshold value and motion detection) if 0<= var.RGB <= var.tresh and (var.OLDpositionX <> mouse.x or var.OLDpositionY <> mouse.y or var.RGB <> var.OLDrgb) then if var.rmbl = false then if var.StartSpeaker = true then wiimote.Frequency = (1- var.RGB) * 1000 if var.StartSpeaker = true then wiimote.Volume = Wiimote.Volume if var.Start = true then wiimote.rumble = 1 // if var.time = 0 then var.time = 100 wait var.time ms wiimote.Rumble = 0 wiimote.Frequency = 0 //wiimote.volume = 0% End if var.OLDrgb = var.RGB var.OLDpositionX = mouse.x var.OLDpositionY = mouse.y var.rmbl = True Else // wiimote.rumble = 0 var.rmbl = False End if if var.tresh < var.RGB <= 1 and (var.OLDpositionX <> mouse.x or var.OLDpositionY <> mouse.y or var.RGB <> var.OLDrgb) then var.OLDrgb = var.RGB var.OLDpositionX = mouse.x var.OLDpositionY = mouse.y // wiimote.rumble = 0 var.rmbl = False End if // idea: lights leds depending on RGB value // but leds are already used to show threshold value debug = var.r+’, ‘+var.g+’, ‘+var.b