このレッスンはの一部です:
SunFounderの3-in-1学習キットに基づくArduinoコース
レッスン12/31:Arduinoプログラミング関数とスイッチの使用 | SunFounder Robojax
このレッスンでは、Arduinoプログラミングの関数とswitch文の基本概念について詳しく説明します。関数の実用的な応用を最良の方法で理解できるように、明確な例を4つ提供し、その後デモンストレーションを行います。続いて、switch文とそのさまざまなcaseシナリオを3つの異なる例を通じて探求します。これらのC++プログラミング要素を理解することは、効果的なArduino開発にとって非常に重要です。
923-Lesson 12/31: Arduino programming function
言語: C++
/*
This sketch demonstrates the Arduino programming : function
Download and resource page https://robojax.com/RJT595
watch video https://www.youtube.com/watch?v=JLF7FQeVlkY
*/
const float voltage = 3.3;
void setup() {
// Robojax Arduino floating points
Serial.begin(9600);// initialize the Serial Monitor
}
void loop() {
//3.141592
Serial.println( pi(), 10 );
//delay(1000);
}
/*
printText: prints the text on Serial monitor
@param t is String text
@ returns nothing
*/
void printText(String t)
{
Serial.println(t);
}
/*
* getDays is calculation the number of days in a year
* @param a is integer
* @param returns integer value of number of days
*/
int getDays(int a)
{
return (a * 365);// multiply a by 365 to get number of days and return it
}
float getArea(float l, float w)
{
float area = l * w;
return area;
}
String makeText(double temperature)
{
String newText;
if (temperature > 60.5)
{
newText = "Very hot";
}else{
newText = "Not hot";
}
return newText;
}
double pi()
{
double p = 3.141592;// 6 decimal points
return p;// returns value of pi
}
float getPower(float i)
{
return i*voltage;//
}
Common Course Links
Common Course Files
必要かもしれないもの
-
アマゾンSunFounder Arduino Learning Kit on AliExpresss.click.aliexpress.com
-
アマゾン
-
アマゾン
-
アマゾン
リソースと参考文献
-
ドキュメンテーションSunFounder 3 in 1 IoT/スマートカー/学習キットのドキュメントdocs.sunfounder.com
-
外部SunFounderの3-in-1スマートカー学習キットを購入するsunfounder.com
ファイル📁
Arduinoライブラリ(zip)
-
SunFounderの3-in-1スマートカー学習キットソースコード
3in1-kit-main-v2.zip12.80 MB
ユーザーマニュアル
-
SunFounder 3-in-1 Arduinoスマートカー組み立てマニュアルこのドキュメントはSunFounder 3-in-1 Arduinoスマートカーのステップバイステップの組み立てを示しています。
SunFounder_car_assembly_manual.pdf1.20 MB