본문 바로가기

전체 글

(292)
CNC Shield_V4 , BT06 bluetooth, appInventor(7) 부르투스+아두이노 나노+CNC shield V4 결합하여 부르투스 통신을 하여봅니다.부르투스는  HC-06 호환용입니다. G마켓에서 구입했습니다. BT06 아래 그림에서 붉은 사각형내의 4핀만 사용합니다. 다음 그림은 CNC Shield v4에 아두이노 나노 보드를 장착했습니다.  부르투스 TxD-->D12, RxD-->D13를 연결하고, 아두이노 보드 위에 전원 Vcc-->5V, GND-->GND 연결하면 됩니다.   부르투스Shield V4RXDD13TXDD12Vcc5GNDGND다음 소스를 업로드합니다.#include SoftwareSerial mySerial(12, 13); // 12-->TXD, 13-->RXDvoid setup() {  Serial.begin(9600);  while (!Seri..
esp32 LED_BUILTIN OnOff(6) 보드에 장착된 Builtin LED GPIO 는 포트번호는 2를 OnOff 해봅니다.아래 소스를 업로드 해봅니다.#include "BluetoothSerial.h"#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it#endifBluetoothSerial SerialBT;void setup() {  Serial.begin(115200); pinMode(2,OUTPUT);  SerialBT.begin("ESP32test"); //Bluetooth device name  Serial.println("T..
arduino 와 esp32 bluetooth(5) ESP32-S 보드는 wifi, BT 두 종류의 통신을 할 수 있습니다. 아래 소스는 부르투스 통신을 해봅니다.* 컴파일이 끝나고 업로딩 시작될때 오른쪽 버튼을 터치해줍니다. #include "BluetoothSerial.h" #if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED) #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it #endif BluetoothSerial SerialBT; void setup() {   Serial.begin(115200);   SerialBT.begin("ESP32test"); //Bluetooth device ..
arduino substring() 함수와 배열(집합) 응용 (4) String A[] = {"g2x10","g1y10","G0x10y10","g3y20","g0y15","g4x5y18","g2x6"}; void setup(){ Serial.begin(115200); for(int x=0;x String xy=A[x].substring(0,2);  Serial.println(xy); } } void loop(){}
arduino 배열 (3) 배열은 집합입니다. 학교에서 배운 것과 같습니다. int A[] = {  } 에서 int는 집합 모든 원소는 정수라는 의미입니다. 그리고  A는 집합 명이고, [ ]는 배열,  {   }에는 원소를 넣습니다.다음 예제는 배열 원소를 출력해봅나다.int A[] = {2, 4, 8, 3, 6, 4}; void setup(){ Serial.begin(115200); for(int x=0;x Serial.println(A[x]); } } void loop(){}결과
arduino substring() , substring(a,b)함수 (2) 문자들의 모임에서 특정 단어이후의 문자들을 출력합니다.String st="qwerttyhg"; void setup(){ Serial.begin(115200); String x=st.substring(4); Serial.println(x);} void loop(){ }4번째 지정한 위치에서 끝까지 출력합니다.String st="qwerttyhg"; void setup(){ Serial.begin(115200); String x=st.substring(4,6); Serial.println(x); } void loop(){}결과와 같이 두 위치 인수를 적용하여 , 단어를 축출 할 수 있습니다.
arduino indexof() ,lastIndexOf()함수 (1) 학습하는 코딩언어의 함수(공식)를 많이 알고 있으면,  간단하고, 쉽고, 명료하게 작성 할 수 았습니다.   indexof() 공식은 많은 문자들의 모임(집합)에서 지정된 문자 위치를 알 수 있습니다.   String st="qwertyhg"; void setup(){ Serial.begin(115200); int x=st.indexOf('t'); Serial.println(x); } void loop(){}결과: st="qwertyhg"; 집합 st 원소 t는 5번째 위치에 있습니다. 코딩에서는 항상 0부터 시작되므로 4가 됩니다. lastIndexOf()는  뒤에서 부터 검색합니다. st 문자열에는 tt가 반복되어있을 겨우 뒤에 t를 지정합니다.String st="qwerttyhg"; void set..
ESP12e Motor shiwld 보호되어 있는 글입니다.