Blog 07

From BitWizard WIKI
Revision as of 13:18, 11 September 2015 by Cartridge1987 (talk | contribs) (In this text harry makes it possible to use the buttons for printing text on the screen)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

!BETA!

first try to see if it can detect the raspberry pi button to make sure if it works I choose to detect the middle number 3. so we read button 23:s without pressing the button it says; 0101 and with pressing the right button it says 0000

$ bw_tool -I -D /dev/i2c-1 -a 94 -R 23:s 
0101 
$ bw_tool -I -D /dev/i2c-1 -a 94 -R 23:s 
0000 

When we make a shell we have to put the code:

if [ `bw_tool -I -D /dev/i2c-1 -a 94 -R 23:s`  = "0000" ]; then 
  echo `bw_tool -I -D /dev/i2c-1 -a 94 -t Friet is lekker` 
fi 

in ir it will look if the place is 0000 and then if that is true it will print the text after that it is finished


what I found out is that the numbers are mirrored so:

20:s = 6
25:s = 1


Now to try the full 6 buttons!


When in mirror in mind we make this code:


#!/bin/bash 

if [ `bw_tool -I -D /dev/i2c-1 -a 94 -R 25:s`  = "0000" ]; then 
  echo `bw_tool -I -D /dev/i2c-1 -a 94 -t W` 
elif [ `bw_tool -I -D /dev/i2c-1 -a 94 -R 24:s`  = "0000" ]; then 
  echo `bw_tool -I -D /dev/i2c-1 -a 94 -t i` 
elif [ `bw_tool -I -D /dev/i2c-1 -a 94 -R 23:s`  = "0000" ]; then 
  echo `bw_tool -I -D /dev/i2c-1 -a 94 -t z` 
elif [ `bw_tool -I -D /dev/i2c-1 -a 94 -R 22:s`  = "0000" ]; then 
  echo `bw_tool -I -D /dev/i2c-1 -a 94 -t a` 
elif [ `bw_tool -I -D /dev/i2c-1 -a 94 -R 21:s`  = "0000" ]; then 
  echo `bw_tool -I -D /dev/i2c-1 -a 94 -t r` 
elif [ `bw_tool -I -D /dev/i2c-1 -a 94 -R 20:s`  = "0000" ]; then 
  echo `bw_tool -I -D /dev/i2c-1 -a 94 -t d` 
fi 

with this code you sadly always have to activate it with

./type

now we have to make it possible you can just keep typing and don't have to turn it on again after every time you entered

./type. 


#!/bin/bash  

 while true; do
 if [ `bw_tool -I -D /dev/i2c-1 -a 94 -R 25:s`  = "0000" ]; then
   echo `bw_tool -I -D /dev/i2c-1 -a 94 -t W`
        sleep 0.4
elif [ `bw_tool -I -D /dev/i2c-1 -a 94 -R 24:s`  = "0000" ]; then
  echo `bw_tool -I -D /dev/i2c-1 -a 94 -t i`
        sleep 0.4
elif [ `bw_tool -I -D /dev/i2c-1 -a 94 -R 23:s`  = "0000" ]; then
  echo `bw_tool -I -D /dev/i2c-1 -a 94 -t z`
        sleep 0.4
elif [ `bw_tool -I -D /dev/i2c-1 -a 94 -R 22:s`  = "0000" ]; then
  echo `bw_tool -I -D /dev/i2c-1 -a 94 -t a`
        sleep 0.4
elif [ `bw_tool -I -D /dev/i2c-1 -a 94 -R 21:s`  = "0000" ]; then
  echo `bw_tool -I -D /dev/i2c-1 -a 94 -t r`
        sleep 0.4
elif [ `bw_tool -I -D /dev/i2c-1 -a 94 -R 20:s`  = "0000" ]; then
  echo `bw_tool -I -D /dev/i2c-1 -a 94 -t d`
         sleep 0.4
fi

done 


Wiz.png
Wizard.png














for now I added sleep 0.4 sec after every echo but this doesn't help because now people have to type slower or faster if you change the time. !BETA!