https://wiki.microduinoinc.com/index.php?title=Bingo_Game_Machine_01&feed=atom&action=historyBingo Game Machine 01 - Revision history2024-03-28T10:41:03ZRevision history for this page on the wikiMediaWiki 1.28.2https://wiki.microduinoinc.com/index.php?title=Bingo_Game_Machine_01&diff=16407&oldid=prevZhangfengfeng: Created page with "{| style="width: 1000px;" |- | ==Overview== center Implement the basic display function of the game machine: display a random number..."2017-03-24T05:29:12Z<p>Created page with "{| style="width: 1000px;" |- | ==Overview== <a href="/File:Anywhere_Bingo_game_1.jpg" title="File:Anywhere Bingo game 1.jpg">600px|center</a> Implement the basic display function of the game machine: display a random number..."</p>
<p><b>New page</b></p><div>{| style="width: 1000px;"<br />
|-<br />
|<br />
<br />
==Overview==<br />
[[File:anywhere_Bingo game 1.jpg|600px|center]]<br />
<br />
Implement the basic display function of the game machine: display a random number on the first line of OLED; display numbers 1-6 on the second line, which can be controlled to roll with a potentiometer; display the score on the third line. <br />
<br><br />
<br />
'''Rule'''<br />
[[File:anywhere_Bingo game 1 rule.jpg|600px|center]]<br />
<br />
==Module List==<br />
===Module===<br />
{|class="wikitable"<br />
|-<br />
|Module||Number||Function<br />
|-<br />
|[[mCookie-Core|mCookie-Core]]||1||Core board <br />
|-<br />
|[[mCookie-Battery|Battery box]]||1||Program download and power supply<br />
|-<br />
|[[mCookie-Hub|mCookie-Hub]]||1||Sensor adapter plate <br />
|-<br />
|[[mCookie-OLED|mCookie-OLED]]||1||Display <br />
|-<br />
|[[Sensor-Potentiometer|Potentiometer]]||1||Detect rotation <br />
|}<br />
<br />
===Other Equipment===<br />
*USB cable*1<br />
*Sensor cable*1<br />
*Sensor shell<br />
*Building blocks or other fixation structures <br />
[[File:anywhere_Bingo game 1-module.jpg|600px|center]]<br />
<br />
==Module Setup==<br />
===Setup===<br />
[[File:anywhere_Bingo game 1-step.jpg|600px|center]]<br />
*Assemble modules and sensors together: <br />
**Stick the red core module, battery base, OLED and green Hub together; <br />
**Connect the Potentiometer to pin A0 of Hub; <br />
**Plug one end of the USB cable into the battery base, and connect the other to the computer. <br />
<br />
==Programming==<br />
===Required Program Blocks===<br />
*[[“OLED begin-println” program block]]<br />
*[[“Variable declaration” and “assignment” program blocks]]<br />
*[[“Text” program block]]<br />
*[[“Random” program block]]<br />
*[[“Function” program block]]<br />
*[[“Rotation Potentiometer” program block]]<br />
<br />
===Programming Thought===<br />
Declare variables to save data, and write function start to produce random numbers, producing one number each time; write function display to display on OLED, displaying the game interface on OLED. At last, run all functions. <br />
[[File:mixly-ctrl-Bingo game 1.jpg|600px|center]]<br />
<br />
===Start to Program===<br />
'''1. Declare variables for storing random numbers and scores'''<br />
<br><br />
Variable a is for storing random numbers and variable score is for storing scores. <br />
[[File:mixly-ctrl-mixly-ctrl-Bingo game 1-code.jpg|600px|center]]<br />
<br><br />
'''2. Write function start for producing random numbers'''<br />
<br><br />
Produce a random number between 1-6 and save it in a. <br />
[[File:mixly-ctrl-Bingo game 1-code1.jpg|600px|center]]<br />
'''3. Write function display to display on OLED'''<br />
<br><br />
Random number a is displayed on the first line of OLED<br />
“1 2 3 4 5 6” is displayed on the second line and the x coordinate is the value of the potentiometer.<br />
SCORE:score (variable for scores) is displayed on the third line <br />
[[File:mixly-ctrl-Bingo game 1-code2.jpg|600px|center]]<br />
<br><br />
'''4. Execute fucntions'''<br />
<br><br />
Execute “start” and “display” two functions. Pay attention to that functions should be put below the declarations. <br />
[[File:mixly-ctrl-Bingo game 1-code3.jpg|600px|center]]<br />
<br><br />
<br><br />
<br><br />
'''Test the result'''<br />
<br><br />
After upload, the random number displayed on the first line of OLED is changing, “1 2 3 4 5 6” is displayed on the second line, and SCORE:0 is displayed on the third line. “1 2 3 4 5 6” on the potentiometer moves OLED quickly. <br />
<br><br />
[[File:anywhere_Bingo game 1.jpg|600px|center]]<br />
<br><br />
<br><br />
'''Q: The width of “1 2 3 4 5 6” is only 90 pixels, the value of the potentiometer is 0-1023, so it is difficult to control to align numbers, how to solve that? '''<br />
<br><br />
'''A: You can restrain the range of the movement with map program block.'''<br />
<br><br />
<br><br />
*Map the value of the potentiometer from 1023-0 to 0-90 (it is 90 on left most, and it is 0 on right most), store the result in b. <br />
*Set the x coordinate of numbers on the second line to 60-b (because the x coordinate of the random number on the first is 60, when the potentiometer is turned to left most, number 6 on the second number is aligned to the random number; when the potentiometer is turned to right most, the x coordinate of the numbers on the second line is also 60, aligned to number 1).<br />
[[File:mixly-ctrl2-Bingo game 1.jpg|600px|center]]<br />
<br><br />
Variable b is for storing the random number. <br />
Function start is not changed. <br />
Change the content of function display. <br />
Map the value of the rotation potentiometer from 1023-0 to 0-90 (it is 0 on left most, and it is 90 on right most), store the result in b. <br />
Set the x coordinate of numbers on the second line to 60-b (because the x coordinate of the random number on the first line is 60, when b is 0, the x coordinate of numbers on the second line is also 60, it is just aligned to 1). <br />
[[File:mixly-ctrl-Bingo game 1-code4.jpg|600px|center]]<br />
<br />
==Technical Specification==<br />
*For more about potentiometer, please refer to [[Sensor-Potentiometer |Potentiometer]]<br />
*For more about OLED, please refer to [[mCookie-OLED|mCookie-OLED]]<br />
<br />
==Relative Cases==<br />
[[Bingo Game Machine 02]]<br />
[[Bingo Game Machine 03]]<br />
[[Bingo Game Machine 04]]<br />
[[Bingo Game Machine 05]]<br />
<br />
==FAQ==<br />
<br />
|}</div>Zhangfengfeng