Zhang Yuexin

C# programmer. Know a bit of hardware knowledge. 3D model design novice.

张高兴 - 土味儿编程

高兴不高兴

张高兴的 Windows 10 IoT 开发笔记:FM 电台模块 KT0803L

本文约 386 字,包含 1 张图片,3 个代码段,阅读时间约 2 分钟
QR Code

在手机上查看此页面


This is a Windows 10 IoT Core project on the Raspberry Pi 2/3, coded by C#.

GitHub:https://github.com/ZhangGaoxing/windows-iot-demo/tree/master/KT0803L

Image

Connect

  • SDA - Pin3
  • SCL - Pin5
  • VCC - 3.3V
  • GND - GND

Reference

https://github.com/ZhangGaoxing/windows-iot-demo/tree/master/KT0803L/Reference

What Contains

In KT0803L.cs file

/// <summary>
/// Initialize KT0803L
/// </summary>
/// <param name="mhz">FM Channel ( Range from 70Mhz to 108Mhz )</param>
/// <param name="country">Region</param>
/// <param name="rfgain">Transmission Power</param>
/// <param name="pga">PGA ( Programmable Gain Amplifier ) Gain</param>
public async Task InitializeAsync(double mhz, Country country = Country.CHINA, RFGAIN rfgain = RFGAIN.RFGAIN_98_9dBuV, PGA pga = PGA.PGA_0dB);

/// <summary>
/// Set FM Channel
/// </summary>
/// <param name="mhz">MHz ( Range from 70Mhz to 108Mhz )</param>
public void SetChannel(double mhz);

/// <summary>
/// Set PGA ( Programmable Gain Amplifier ) Gain
/// </summary>
/// <param name="pga">PGA</param>
public void SetPGA(PGA pga);

/// <summary>
/// Set Transmission Power
/// </summary>
/// <param name="pga"></param>
public void SetRFGAIN(RFGAIN rfgain);

/// <summary>
/// Set Pre-emphasis Time-Constant
/// </summary>
/// <param name="country">Country</param>
public void SetPHTCNST(Country country);

/// <summary>
/// Set Mute Mode
/// </summary>
/// <param name="isMute">Mute when value is true</param>
public void SetMute(bool isMute);

/// <summary>
/// Set Standby Mode
/// </summary>
/// <param name="isStandby">Standby when value is true</param>
public void SetStandby(bool isStandby);

/// <summary>
/// Set Bass Boost
/// </summary>
/// <param name="boost">Boost Mode</param>
public void SetBassBoost(BassBoost boost);

/// <summary>
/// Cleanup
/// </summary>
public void Dispose();

How to Use

  • First, you need to create a KT0803L object. After that you should call InitializeAsync() to initialize.
KT0803L kt = new KT0803L();
// 108 MHz
await kt.InitializeAsync(108);
  • And you can input the audio through the 3.5mm earphone jack. After that, turn on your radio, listen to FM 108 MHz.
  • If you want to close the sensor, call Dispose().
kt.Dispose();
最后更新时间 : 2018/01/14 00:18 张高兴 阅读(431) 评论(0)
文章标签: C# UWP IoT Raspberry Pi
  发表评论
Click to Refresh