Ferris wheel for fun

一直想要學Arduino, 加上想要自己手作一份禮物給VIP,所以才有做這個”摩天輪” project的想法。
其實我也不知道為什麼偏偏要選一個自己的弱項做這份禮物。從小不太喜歡做勞作,手不巧:( 也沒有電子的概念。
卻想要做一個會轉動又有RGB燈特效的摩天輪……一開始的陰影面積就超級大R~~~…。

著手這個計畫後才開始找很多資料,看Youtube,一步一步地學著做
有了一些想法後就開始買材料

八月九月就開始訂了一些材料,打算用冰棒木片和熱熔槍做摩天輪的骨架

八月時用arduino控制可程式的RGB LED燈(WS2812B 1m 60leds 5V 8A)
接好線路和把code upload到 Arduino後看到成果還滿順利的呈現,真的有種感動的感覺 哈哈哈哈哈哈

終於十月中某天晚上把結構做好,看過的朋友都還滿喜歡的。 話說轉動起來的感覺,真的還不錯 :):):)

今天晚上(2018-11-5)試試看用Arduino 來控制stepper motor 和同時控制RGB燈
改了一些CODE 整合起來再把power supply and data cable都接好,滿順利就達到想要的效果
還把一些線路做一個整理和焊接…第一次焊….才知道這麼難弄…哈
(28BYJ-48 unipolar stepper motor + ULN2003 stepper motor driver board)

————–待續 2018-11-5—————————-

[Project] The Monty Hall Problem

Recently I watched this Youtube video ( The Monty Hall Problem )

“Put simply: If you pick a goat then swap you will always win the car. And you have a 2/3 probability of picking a goat.”

I was so amazed by this logic and static thinking problem.

I use PowerShell to write this The Monty Hall Problem prove program and as yo can see from the program result screenshot,

there is very high chance you get a car when you swap your answer.

just for fun and for practice 🙂

The_Monty_Hall_Problem

PS C:\Users\chako> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      14393  1532

Powershell script:


##################################################################
#
#   The Monty Hall Problem 
#   Youtube : https://www.youtube.com/watch?v=mhlc7peGlGg   
#
#   Raymond Liu 
#   
#
#   2017 / 09 / 13 v1
#   
################# Settings ################################


$getCar = 100
$Goat   = 0



try {
    
	for ($q=1; $q -le 10; $q++) {
	
        for ($i=1; $i -le 10; $i++) {
	
	        # the PowerShell cmdlet generates random numbers you must always set the Maximum value 
		    # to one number beyond your desired limt to fit within the accepted range
	        $TempA      = Get-Random -Maximum 4 -Minimum 1
            $TempB      = Get-Random -Maximum 4 -Minimum 1
		
            if ($TempA  -eq $TempB) {
	            $check = "X"
				$getCar--
	        } else {
	            $check = "O"
	        }
		
		    Write-Host(" " + $check + " ") -ForegroundColor Red -NoNewline
	    }
		Write-Host(" ");
	}
	
    $Goat = 100 - $getCar

    Write-Host(" `n") 
    Write-Host("Car: " + $getCar + "%`n") -ForegroundColor Yellow
    Write-Host("Goat: " + $Goat + "%`n`n") -ForegroundColor Yellow
 
} catch {
 
    Write-Host("`n[ERROR] Something Wrong. `n") -ForegroundColor Red
    Exit 1 
 
}

🙂
🙂

Powershell script with recursive:


##################################################################
#
#   The Monty Hall Problem 
#   Youtube : https://www.youtube.com/watch?v=mhlc7peGlGg   
#
#   Raymond Liu 
#   
#
#   2017 / 09 / 14 v2 recursive
#   
################# Settings ################################


$global:getCar = 100
$global:Goat   = 0

$count  = 10

$recursivecount = 1


try {
    
	Function recursive{
	
        $count--
		
		
        If($count -ge 0){
		
		    # the PowerShell cmdlet generates random numbers you must always set the Maximum value 
		    # to one number beyond your desired limt to fit within the accepted range
	        $TempA      = Get-Random -Maximum 4 -Minimum 1
            $TempB      = Get-Random -Maximum 4 -Minimum 1
		    
			if ($TempA  -eq $TempB) {
	            $check = "X"
				$global:getCar --
				#Write-Host("Car: " + $getCar + "%`n") -ForegroundColor Yellow
	        } else {
	            $check = "O"
	        }
			
            Write-Host(" " + $check + " ") -ForegroundColor Red -NoNewline
			
			if ($count -eq 0 -and  $recursivecount -lt 10) {
			    $count = 10
				$recursivecount++
				Write-Host(" ");
			}
            recursive
        }
    }

    recursive
	$Goat = 100 - $getCar

                Write-Host(" `n") 
                Write-Host("Car: " + $getCar + "%`n") -ForegroundColor Yellow
                Write-Host("Goat: " + $Goat + "%`n`n") -ForegroundColor Yellow
 
} catch {
 
    Write-Host("`n[ERROR] Something Wrong. `n") -ForegroundColor Red
    Exit 1 
 
}