Golang - According to the temperature control fan speed

Hi,

After reading golang’s tutorials on the wiki.

I feel interesting about golang.So I try to do something.

====According to the temperature control fan speed===

Here are the main codes:

package main

import (

    "fmt"

    "time"

    "github.com/tjCFeng/GoRK3288/RK3288"

)

func main() {

    defer RK3288.FreeRK3288()

    PWM1, _ := RK3288.CreatePWM(RK3288.PWM_1)

    PWM1.SetInactivePolarity(RK3288.Positive)

    PWM1.SetPERIOD(50000)

    PWM1.SetDUTY(0)

    PWM1.SetCNT(0)

    PWM1.Start()

    for{

            time.Sleep(time.Second * 1)

            _, Data, _, _ := RK3288.ITSADC().GetData()

            var adc_date = RK3288.ITSADC().GetTemperature(Data)

            fmt.Println("Temperature:",adc_date)

            fmt.Println("Period:",50000)

            if adc_date <= 40{

                    PWM1.Stop()

                    PWM1.SetPERIOD(50000)

                    PWM1.SetDUTY(50000)

                    PWM1.SetCNT(0)

                    PWM1.Start()

                    fmt.Println("Duty:",0)

            }else if adc_date >= 40 || adc_date <= 60{

                    PWM1.Stop()

                    PWM1.SetPERIOD(50000)

                    PWM1.SetDUTY(50000-(uint32)(adc_date) * 766)

                    PWM1.SetCNT(0)

                    PWM1.Start()

                    fmt.Println("Duty:",(50000-(uint32)(adc_date) * 766))

            }else if adc_date >= 60{

                    PWM1.Stop()

                    PWM1.SetPERIOD(50000)

                    PWM1.SetDUTY(0)

                    PWM1.SetCNT(0)

                    PWM1.Start()

                    fmt.Println("Duty:",50000)

            }

    }

}

i’m using android 4.4 KK, it’s possible implement it in android ?
If yes how can we integrate it?

Thanks a lot for share your work.

psycmos Posted at 7/2/2015 21:17
i’m using android 4.4 KK, it’s possible implement it in android ?
If yes how can we integrate it?

Hi,
Android should be don’t support, now support systems have Windows, Linux, MacOS X

Thank you for your article, it truly left me stunned! The Latest Cybersecurity-Practitioner exam tutorial test questions are essential for career success—available for free!