センサーの値0...1023を0...約3.3V(1％)に変換してあそぶ(51.5掛けて16で割る)(オンラインコンパイラ)


参考

https://qiita.com/caa45040/items/c5df0d013f73f0fe8e63

結果

![o_coq305.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/840352/b52eeec8-559a-298b-d782-df53b332bf33.jpeg)


プログラム

オンラインコンパイラ


```c++

#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    printf("START\n");
    
    unsigned short vo;
    for(int s=0;s<1025;s++){
        
        vo = s;
        
        vo = ((vo * 51U)+(vo >> 1))>>4;
        
        printf("(%d)[%d]\n",s,vo);
        
    }//for
    printf("\n");
}//main


```

```


START
(0)[0]
(1)[3]
(2)[6]
(3)[9]
(4)[12]
(5)[16]
(6)[19]
(7)[22]
(8)[25]
(9)[28]
(10)[32]
(11)[35]
(12)[38]
(13)[41]
(14)[45]
(15)[48]
(16)[51]
(17)[54]
(18)[57]
(19)[61]
(20)[64]
(21)[67]
(22)[70]
(23)[74]
(24)[77]
(25)[80]
(26)[83]
(27)[86]
(28)[90]
(29)[93]
(30)[96]
(31)[99]
(32)[103]
(33)[106]
(34)[109]
(35)[112]
(36)[115]
(37)[119]
(38)[122]
(39)[125]
(40)[128]
(41)[131]
(42)[135]
(43)[138]
(44)[141]
(45)[144]
(46)[148]
(47)[151]
(48)[154]
(49)[157]
(50)[160]
(51)[164]
(52)[167]
(53)[170]
(54)[173]
(55)[177]
(56)[180]
(57)[183]
(58)[186]
(59)[189]
(60)[193]
(61)[196]
(62)[199]
(63)[202]
(64)[206]
(65)[209]
(66)[212]
(67)[215]
(68)[218]
(69)[222]
(70)[225]
(71)[228]
(72)[231]
(73)[234]
(74)[238]
(75)[241]
(76)[244]
(77)[247]
(78)[251]
(79)[254]
(80)[257]
(81)[260]
(82)[263]
(83)[267]
(84)[270]
(85)[273]
(86)[276]
(87)[280]
(88)[283]
(89)[286]
(90)[289]
(91)[292]
(92)[296]
(93)[299]
(94)[302]
(95)[305]
(96)[309]
(97)[312]
(98)[315]
(99)[318]
(100)[321]
(101)[325]
(102)[328]
(103)[331]
(104)[334]
(105)[337]
(106)[341]
(107)[344]
(108)[347]
(109)[350]
(110)[354]
(111)[357]
(112)[360]
(113)[363]
(114)[366]
(115)[370]
(116)[373]
(117)[376]
(118)[379]
(119)[383]
(120)[386]
(121)[389]
(122)[392]
(123)[395]
(124)[399]
(125)[402]
(126)[405]
(127)[408]
(128)[412]
(129)[415]
(130)[418]
(131)[421]
(132)[424]
(133)[428]
(134)[431]
(135)[434]
(136)[437]
(137)[440]
(138)[444]
(139)[447]
(140)[450]
(141)[453]
(142)[457]
(143)[460]
(144)[463]
(145)[466]
(146)[469]
(147)[473]
(148)[476]
(149)[479]
(150)[482]
(151)[486]
(152)[489]
(153)[492]
(154)[495]
(155)[498]
(156)[502]
(157)[505]
(158)[508]
(159)[511]
(160)[515]
(161)[518]
(162)[521]
(163)[524]
(164)[527]
(165)[531]
(166)[534]
(167)[537]
(168)[540]
(169)[543]
(170)[547]
(171)[550]
(172)[553]
(173)[556]
(174)[560]
(175)[563]
(176)[566]
(177)[569]
(178)[572]
(179)[576]
(180)[579]
(181)[582]
(182)[585]
(183)[589]
(184)[592]
(185)[595]
(186)[598]
(187)[601]
(188)[605]
(189)[608]
(190)[611]
(191)[614]
(192)[618]
(193)[621]
(194)[624]
(195)[627]
(196)[630]
(197)[634]
(198)[637]
(199)[640]
(200)[643]
(201)[646]
(202)[650]
(203)[653]
(204)[656]
(205)[659]
(206)[663]
(207)[666]
(208)[669]
(209)[672]
(210)[675]
(211)[679]
(212)[682]
(213)[685]
(214)[688]
(215)[692]
(216)[695]
(217)[698]
(218)[701]
(219)[704]
(220)[708]
(221)[711]
(222)[714]
(223)[717]
(224)[721]
(225)[724]
(226)[727]
(227)[730]
(228)[733]
(229)[737]
(230)[740]
(231)[743]
(232)[746]
(233)[749]
(234)[753]
(235)[756]
(236)[759]
(237)[762]
(238)[766]
(239)[769]
(240)[772]
(241)[775]
(242)[778]
(243)[782]
(244)[785]
(245)[788]
(246)[791]
(247)[795]
(248)[798]
(249)[801]
(250)[804]
(251)[807]
(252)[811]
(253)[814]
(254)[817]
(255)[820]
(256)[824]
(257)[827]
(258)[830]
(259)[833]
(260)[836]
(261)[840]
(262)[843]
(263)[846]
(264)[849]
(265)[852]
(266)[856]
(267)[859]
(268)[862]
(269)[865]
(270)[869]
(271)[872]
(272)[875]
(273)[878]
(274)[881]
(275)[885]
(276)[888]
(277)[891]
(278)[894]
(279)[898]
(280)[901]
(281)[904]
(282)[907]
(283)[910]
(284)[914]
(285)[917]
(286)[920]
(287)[923]
(288)[927]
(289)[930]
(290)[933]
(291)[936]
(292)[939]
(293)[943]
(294)[946]
(295)[949]
(296)[952]
(297)[955]
(298)[959]
(299)[962]
(300)[965]
(301)[968]
(302)[972]
(303)[975]
(304)[978]
(305)[981]
(306)[984]
(307)[988]
(308)[991]
(309)[994]
(310)[997]
(311)[1001]
(312)[1004]
(313)[1007]
(314)[1010]
(315)[1013]
(316)[1017]
(317)[1020]
(318)[1023]
(319)[1026]
(320)[1030]
(321)[1033]
(322)[1036]
(323)[1039]
(324)[1042]
(325)[1046]
(326)[1049]
(327)[1052]
(328)[1055]
(329)[1058]
(330)[1062]
(331)[1065]
(332)[1068]
(333)[1071]
(334)[1075]
(335)[1078]
(336)[1081]
(337)[1084]
(338)[1087]
(339)[1091]
(340)[1094]
(341)[1097]
(342)[1100]
(343)[1104]
(344)[1107]
(345)[1110]
(346)[1113]
(347)[1116]
(348)[1120]
(349)[1123]
(350)[1126]
(351)[1129]
(352)[1133]
(353)[1136]
(354)[1139]
(355)[1142]
(356)[1145]
(357)[1149]
(358)[1152]
(359)[1155]
(360)[1158]
(361)[1161]
(362)[1165]
(363)[1168]
(364)[1171]
(365)[1174]
(366)[1178]
(367)[1181]
(368)[1184]
(369)[1187]
(370)[1190]
(371)[1194]
(372)[1197]
(373)[1200]
(374)[1203]
(375)[1207]
(376)[1210]
(377)[1213]
(378)[1216]
(379)[1219]
(380)[1223]
(381)[1226]
(382)[1229]
(383)[1232]
(384)[1236]
(385)[1239]
(386)[1242]
(387)[1245]
(388)[1248]
(389)[1252]
(390)[1255]
(391)[1258]
(392)[1261]
(393)[1264]
(394)[1268]
(395)[1271]
(396)[1274]
(397)[1277]
(398)[1281]
(399)[1284]
(400)[1287]
(401)[1290]
(402)[1293]
(403)[1297]
(404)[1300]
(405)[1303]
(406)[1306]
(407)[1310]
(408)[1313]
(409)[1316]
(410)[1319]
(411)[1322]
(412)[1326]
(413)[1329]
(414)[1332]
(415)[1335]
(416)[1339]
(417)[1342]
(418)[1345]
(419)[1348]
(420)[1351]
(421)[1355]
(422)[1358]
(423)[1361]
(424)[1364]
(425)[1367]
(426)[1371]
(427)[1374]
(428)[1377]
(429)[1380]
(430)[1384]
(431)[1387]
(432)[1390]
(433)[1393]
(434)[1396]
(435)[1400]
(436)[1403]
(437)[1406]
(438)[1409]
(439)[1413]
(440)[1416]
(441)[1419]
(442)[1422]
(443)[1425]
(444)[1429]
(445)[1432]
(446)[1435]
(447)[1438]
(448)[1442]
(449)[1445]
(450)[1448]
(451)[1451]
(452)[1454]
(453)[1458]
(454)[1461]
(455)[1464]
(456)[1467]
(457)[1470]
(458)[1474]
(459)[1477]
(460)[1480]
(461)[1483]
(462)[1487]
(463)[1490]
(464)[1493]
(465)[1496]
(466)[1499]
(467)[1503]
(468)[1506]
(469)[1509]
(470)[1512]
(471)[1516]
(472)[1519]
(473)[1522]
(474)[1525]
(475)[1528]
(476)[1532]
(477)[1535]
(478)[1538]
(479)[1541]
(480)[1545]
(481)[1548]
(482)[1551]
(483)[1554]
(484)[1557]
(485)[1561]
(486)[1564]
(487)[1567]
(488)[1570]
(489)[1573]
(490)[1577]
(491)[1580]
(492)[1583]
(493)[1586]
(494)[1590]
(495)[1593]
(496)[1596]
(497)[1599]
(498)[1602]
(499)[1606]
(500)[1609]
(501)[1612]
(502)[1615]
(503)[1619]
(504)[1622]
(505)[1625]
(506)[1628]
(507)[1631]
(508)[1635]
(509)[1638]
(510)[1641]
(511)[1644]
(512)[1648]
(513)[1651]
(514)[1654]
(515)[1657]
(516)[1660]
(517)[1664]
(518)[1667]
(519)[1670]
(520)[1673]
(521)[1676]
(522)[1680]
(523)[1683]
(524)[1686]
(525)[1689]
(526)[1693]
(527)[1696]
(528)[1699]
(529)[1702]
(530)[1705]
(531)[1709]
(532)[1712]
(533)[1715]
(534)[1718]
(535)[1722]
(536)[1725]
(537)[1728]
(538)[1731]
(539)[1734]
(540)[1738]
(541)[1741]
(542)[1744]
(543)[1747]
(544)[1751]
(545)[1754]
(546)[1757]
(547)[1760]
(548)[1763]
(549)[1767]
(550)[1770]
(551)[1773]
(552)[1776]
(553)[1779]
(554)[1783]
(555)[1786]
(556)[1789]
(557)[1792]
(558)[1796]
(559)[1799]
(560)[1802]
(561)[1805]
(562)[1808]
(563)[1812]
(564)[1815]
(565)[1818]
(566)[1821]
(567)[1825]
(568)[1828]
(569)[1831]
(570)[1834]
(571)[1837]
(572)[1841]
(573)[1844]
(574)[1847]
(575)[1850]
(576)[1854]
(577)[1857]
(578)[1860]
(579)[1863]
(580)[1866]
(581)[1870]
(582)[1873]
(583)[1876]
(584)[1879]
(585)[1882]
(586)[1886]
(587)[1889]
(588)[1892]
(589)[1895]
(590)[1899]
(591)[1902]
(592)[1905]
(593)[1908]
(594)[1911]
(595)[1915]
(596)[1918]
(597)[1921]
(598)[1924]
(599)[1928]
(600)[1931]
(601)[1934]
(602)[1937]
(603)[1940]
(604)[1944]
(605)[1947]
(606)[1950]
(607)[1953]
(608)[1957]
(609)[1960]
(610)[1963]
(611)[1966]
(612)[1969]
(613)[1973]
(614)[1976]
(615)[1979]
(616)[1982]
(617)[1985]
(618)[1989]
(619)[1992]
(620)[1995]
(621)[1998]
(622)[2002]
(623)[2005]
(624)[2008]
(625)[2011]
(626)[2014]
(627)[2018]
(628)[2021]
(629)[2024]
(630)[2027]
(631)[2031]
(632)[2034]
(633)[2037]
(634)[2040]
(635)[2043]
(636)[2047]
(637)[2050]
(638)[2053]
(639)[2056]
(640)[2060]
(641)[2063]
(642)[2066]
(643)[2069]
(644)[2072]
(645)[2076]
(646)[2079]
(647)[2082]
(648)[2085]
(649)[2088]
(650)[2092]
(651)[2095]
(652)[2098]
(653)[2101]
(654)[2105]
(655)[2108]
(656)[2111]
(657)[2114]
(658)[2117]
(659)[2121]
(660)[2124]
(661)[2127]
(662)[2130]
(663)[2134]
(664)[2137]
(665)[2140]
(666)[2143]
(667)[2146]
(668)[2150]
(669)[2153]
(670)[2156]
(671)[2159]
(672)[2163]
(673)[2166]
(674)[2169]
(675)[2172]
(676)[2175]
(677)[2179]
(678)[2182]
(679)[2185]
(680)[2188]
(681)[2191]
(682)[2195]
(683)[2198]
(684)[2201]
(685)[2204]
(686)[2208]
(687)[2211]
(688)[2214]
(689)[2217]
(690)[2220]
(691)[2224]
(692)[2227]
(693)[2230]
(694)[2233]
(695)[2237]
(696)[2240]
(697)[2243]
(698)[2246]
(699)[2249]
(700)[2253]
(701)[2256]
(702)[2259]
(703)[2262]
(704)[2266]
(705)[2269]
(706)[2272]
(707)[2275]
(708)[2278]
(709)[2282]
(710)[2285]
(711)[2288]
(712)[2291]
(713)[2294]
(714)[2298]
(715)[2301]
(716)[2304]
(717)[2307]
(718)[2311]
(719)[2314]
(720)[2317]
(721)[2320]
(722)[2323]
(723)[2327]
(724)[2330]
(725)[2333]
(726)[2336]
(727)[2340]
(728)[2343]
(729)[2346]
(730)[2349]
(731)[2352]
(732)[2356]
(733)[2359]
(734)[2362]
(735)[2365]
(736)[2369]
(737)[2372]
(738)[2375]
(739)[2378]
(740)[2381]
(741)[2385]
(742)[2388]
(743)[2391]
(744)[2394]
(745)[2397]
(746)[2401]
(747)[2404]
(748)[2407]
(749)[2410]
(750)[2414]
(751)[2417]
(752)[2420]
(753)[2423]
(754)[2426]
(755)[2430]
(756)[2433]
(757)[2436]
(758)[2439]
(759)[2443]
(760)[2446]
(761)[2449]
(762)[2452]
(763)[2455]
(764)[2459]
(765)[2462]
(766)[2465]
(767)[2468]
(768)[2472]
(769)[2475]
(770)[2478]
(771)[2481]
(772)[2484]
(773)[2488]
(774)[2491]
(775)[2494]
(776)[2497]
(777)[2500]
(778)[2504]
(779)[2507]
(780)[2510]
(781)[2513]
(782)[2517]
(783)[2520]
(784)[2523]
(785)[2526]
(786)[2529]
(787)[2533]
(788)[2536]
(789)[2539]
(790)[2542]
(791)[2546]
(792)[2549]
(793)[2552]
(794)[2555]
(795)[2558]
(796)[2562]
(797)[2565]
(798)[2568]
(799)[2571]
(800)[2575]
(801)[2578]
(802)[2581]
(803)[2584]
(804)[2587]
(805)[2591]
(806)[2594]
(807)[2597]
(808)[2600]
(809)[2603]
(810)[2607]
(811)[2610]
(812)[2613]
(813)[2616]
(814)[2620]
(815)[2623]
(816)[2626]
(817)[2629]
(818)[2632]
(819)[2636]
(820)[2639]
(821)[2642]
(822)[2645]
(823)[2649]
(824)[2652]
(825)[2655]
(826)[2658]
(827)[2661]
(828)[2665]
(829)[2668]
(830)[2671]
(831)[2674]
(832)[2678]
(833)[2681]
(834)[2684]
(835)[2687]
(836)[2690]
(837)[2694]
(838)[2697]
(839)[2700]
(840)[2703]
(841)[2706]
(842)[2710]
(843)[2713]
(844)[2716]
(845)[2719]
(846)[2723]
(847)[2726]
(848)[2729]
(849)[2732]
(850)[2735]
(851)[2739]
(852)[2742]
(853)[2745]
(854)[2748]
(855)[2752]
(856)[2755]
(857)[2758]
(858)[2761]
(859)[2764]
(860)[2768]
(861)[2771]
(862)[2774]
(863)[2777]
(864)[2781]
(865)[2784]
(866)[2787]
(867)[2790]
(868)[2793]
(869)[2797]
(870)[2800]
(871)[2803]
(872)[2806]
(873)[2809]
(874)[2813]
(875)[2816]
(876)[2819]
(877)[2822]
(878)[2826]
(879)[2829]
(880)[2832]
(881)[2835]
(882)[2838]
(883)[2842]
(884)[2845]
(885)[2848]
(886)[2851]
(887)[2855]
(888)[2858]
(889)[2861]
(890)[2864]
(891)[2867]
(892)[2871]
(893)[2874]
(894)[2877]
(895)[2880]
(896)[2884]
(897)[2887]
(898)[2890]
(899)[2893]
(900)[2896]
(901)[2900]
(902)[2903]
(903)[2906]
(904)[2909]
(905)[2912]
(906)[2916]
(907)[2919]
(908)[2922]
(909)[2925]
(910)[2929]
(911)[2932]
(912)[2935]
(913)[2938]
(914)[2941]
(915)[2945]
(916)[2948]
(917)[2951]
(918)[2954]
(919)[2958]
(920)[2961]
(921)[2964]
(922)[2967]
(923)[2970]
(924)[2974]
(925)[2977]
(926)[2980]
(927)[2983]
(928)[2987]
(929)[2990]
(930)[2993]
(931)[2996]
(932)[2999]
(933)[3003]
(934)[3006]
(935)[3009]
(936)[3012]
(937)[3015]
(938)[3019]
(939)[3022]
(940)[3025]
(941)[3028]
(942)[3032]
(943)[3035]
(944)[3038]
(945)[3041]
(946)[3044]
(947)[3048]
(948)[3051]
(949)[3054]
(950)[3057]
(951)[3061]
(952)[3064]
(953)[3067]
(954)[3070]
(955)[3073]
(956)[3077]
(957)[3080]
(958)[3083]
(959)[3086]
(960)[3090]
(961)[3093]
(962)[3096]
(963)[3099]
(964)[3102]
(965)[3106]
(966)[3109]
(967)[3112]
(968)[3115]
(969)[3118]
(970)[3122]
(971)[3125]
(972)[3128]
(973)[3131]
(974)[3135]
(975)[3138]
(976)[3141]
(977)[3144]
(978)[3147]
(979)[3151]
(980)[3154]
(981)[3157]
(982)[3160]
(983)[3164]
(984)[3167]
(985)[3170]
(986)[3173]
(987)[3176]
(988)[3180]
(989)[3183]
(990)[3186]
(991)[3189]
(992)[3193]
(993)[3196]
(994)[3199]
(995)[3202]
(996)[3205]
(997)[3209]
(998)[3212]
(999)[3215]
(1000)[3218]
(1001)[3221]
(1002)[3225]
(1003)[3228]
(1004)[3231]
(1005)[3234]
(1006)[3238]
(1007)[3241]
(1008)[3244]
(1009)[3247]
(1010)[3250]
(1011)[3254]
(1012)[3257]
(1013)[3260]
(1014)[3263]
(1015)[3267]
(1016)[3270]
(1017)[3273]
(1018)[3276]
(1019)[3279]
(1020)[3283]
(1021)[3286]
(1022)[3289]
(1023)[3292]
(1024)[3296]



```