1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SG90のサーボー信号を計算してみる

Posted at

x 過去ログを見よ!!!
x M5nanoC6にサブマイコン(STM32L010)を通す
x arduinoは、電子工作なので
x 予定は、未定

o_coq464.jpg

オンラインコンパイラを使用


#define V_0    500
#define V_180 2400
#define HH  ((V_180-V_0)*1024)/180
#define SO(AA) (V_0+(((AA)*(HH))>>10))

#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a;
    for(int i=0;i<(180+1);i++){
        a = SO(i);
        //a = SO(180-i);
        printf("[%d]<%d>\n",i,a);
    }//for
}//main



[0]<500>
[1]<510>
[2]<521>
[3]<531>
[4]<542>
[5]<552>
[6]<563>
[7]<573>
[8]<584>
[9]<594>
[10]<605>
[11]<616>
[12]<626>
[13]<637>
[14]<647>
[15]<658>
[16]<668>
[17]<679>
[18]<689>
[19]<700>
[20]<711>
[21]<721>
[22]<732>
[23]<742>
[24]<753>
[25]<763>
[26]<774>
[27]<784>
[28]<795>
[29]<806>
[30]<816>
[31]<827>
[32]<837>
[33]<848>
[34]<858>
[35]<869>
[36]<879>
[37]<890>
[38]<901>
[39]<911>
[40]<922>
[41]<932>
[42]<943>
[43]<953>
[44]<964>
[45]<974>
[46]<985>
[47]<996>
[48]<1006>
[49]<1017>
[50]<1027>
[51]<1038>
[52]<1048>
[53]<1059>
[54]<1069>
[55]<1080>
[56]<1091>
[57]<1101>
[58]<1112>
[59]<1122>
[60]<1133>
[61]<1143>
[62]<1154>
[63]<1164>
[64]<1175>
[65]<1186>
[66]<1196>
[67]<1207>
[68]<1217>
[69]<1228>
[70]<1238>
[71]<1249>
[72]<1259>
[73]<1270>
[74]<1281>
[75]<1291>
[76]<1302>
[77]<1312>
[78]<1323>
[79]<1333>
[80]<1344>
[81]<1354>
[82]<1365>
[83]<1376>
[84]<1386>
[85]<1397>
[86]<1407>
[87]<1418>
[88]<1428>
[89]<1439>
[90]<1449>
[91]<1460>
[92]<1471>
[93]<1481>
[94]<1492>
[95]<1502>
[96]<1513>
[97]<1523>
[98]<1534>
[99]<1544>
[100]<1555>
[101]<1566>
[102]<1576>
[103]<1587>
[104]<1597>
[105]<1608>
[106]<1618>
[107]<1629>
[108]<1639>
[109]<1650>
[110]<1661>
[111]<1671>
[112]<1682>
[113]<1692>
[114]<1703>
[115]<1713>
[116]<1724>
[117]<1734>
[118]<1745>
[119]<1756>
[120]<1766>
[121]<1777>
[122]<1787>
[123]<1798>
[124]<1808>
[125]<1819>
[126]<1829>
[127]<1840>
[128]<1851>
[129]<1861>
[130]<1872>
[131]<1882>
[132]<1893>
[133]<1903>
[134]<1914>
[135]<1924>
[136]<1935>
[137]<1945>
[138]<1956>
[139]<1967>
[140]<1977>
[141]<1988>
[142]<1998>
[143]<2009>
[144]<2019>
[145]<2030>
[146]<2040>
[147]<2051>
[148]<2062>
[149]<2072>
[150]<2083>
[151]<2093>
[152]<2104>
[153]<2114>
[154]<2125>
[155]<2135>
[156]<2146>
[157]<2157>
[158]<2167>
[159]<2178>
[160]<2188>
[161]<2199>
[162]<2209>
[163]<2220>
[164]<2230>
[165]<2241>
[166]<2252>
[167]<2262>
[168]<2273>
[169]<2283>
[170]<2294>
[171]<2304>
[172]<2315>
[173]<2325>
[174]<2336>
[175]<2347>
[176]<2357>
[177]<2368>
[178]<2378>
[179]<2389>
[180]<2399>


1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?