File size: 16,560 Bytes
df8502b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Arduino Code Reference - DocVortex</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<link rel="stylesheet" href="style.css">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
</head>
<body class="bg-gray-900 text-white overflow-x-hidden">
<!-- Navigation -->
<doc-navbar></doc-navbar>
<!-- Code Reference Section -->
<section class="pt-24 pb-12 px-4">
<div class="max-w-7xl mx-auto">
<div class="text-center mb-16">
<h1 class="text-5xl md:text-6xl font-bold mb-6 bg-gradient-to-r from-cyan-400 via-purple-500 to-pink-500 bg-clip-text text-transparent">
Arduino Code Reference
</h1>
<p class="text-xl text-gray-300 max-w-3xl mx-auto">
Complete reference for Arduino programming language, functions, and libraries.
</p>
</div>
<!-- Search Bar -->
<div class="max-w-2xl mx-auto mb-12">
<div class="relative">
<input type="text" placeholder="Search functions, libraries, or keywords..."
class="w-full px-6 py-4 bg-gray-800/50 backdrop-blur-sm rounded-full border border-white/20 focus:outline-none focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20 text-white placeholder-gray-400">
<button class="absolute right-2 top-2 p-3 bg-gradient-to-r from-cyan-500 to-purple-600 rounded-full">
<i data-feather="search" class="w-5 h-5"></i>
</button>
</div>
</div>
<!-- Categories -->
<div class="grid md:grid-cols-3 lg:grid-cols-4 gap-6 mb-16">
<div class="bg-gray-800/50 backdrop-blur-sm rounded-2xl p-6 border border-white/10 hover:border-cyan-500/50 transition-all duration-300 cursor-pointer">
<div class="w-12 h-12 bg-gradient-to-r from-cyan-500 to-blue-600 rounded-xl mb-4 flex items-center justify-center">
<i data-feather="zap" class="w-6 h-6 text-white"></i>
</div>
<h3 class="text-xl font-bold mb-2">Digital I/O</h3>
<p class="text-gray-400 text-sm">pinMode(), digitalRead(), digitalWrite()</p>
</div>
<div class="bg-gray-800/50 backdrop-blur-sm rounded-2xl p-6 border border-white/10 hover:border-purple-500/50 transition-all duration-300 cursor-pointer">
<div class="w-12 h-12 bg-gradient-to-r from-purple-500 to-pink-600 rounded-xl mb-4 flex items-center justify-center">
<i data-feather="trending-up" class="w-6 h-6 text-white"></i>
</div>
<h3 class="text-xl font-bold mb-2">Analog I/O</h3>
<p class="text-gray-400 text-sm">analogRead(), analogWrite(), analogReference()</p>
</div>
<div class="bg-gray-800/50 backdrop-blur-sm rounded-2xl p-6 border border-white/10 hover:border-green-500/50 transition-all duration-300 cursor-pointer">
<div class="w-12 h-12 bg-gradient-to-r from-green-500 to-cyan-600 rounded-xl mb-4 flex items-center justify-center">
<i data-feather="clock" class="w-6 h-6 text-white"></i>
</div>
<h3 class="text-xl font-bold mb-2">Time Functions</h3>
<p class="text-gray-400 text-sm">millis(), micros(), delay(), delayMicroseconds()</p>
</div>
<div class="bg-gray-800/50 backdrop-blur-sm rounded-2xl p-6 border border-white/10 hover:border-yellow-500/50 transition-all duration-300 cursor-pointer">
<div class="w-12 h-12 bg-gradient-to-r from-yellow-500 to-orange-600 rounded-xl mb-4 flex items-center justify-center">
<i data-feather="terminal" class="w-6 h-6 text-white"></i>
</div>
<h3 class="text-xl font-bold mb-2">Serial Communication</h3>
<p class="text-gray-400 text-sm">Serial.begin(), Serial.print(), Serial.read()</p>
</div>
<div class="bg-gray-800/50 backdrop-blur-sm rounded-2xl p-6 border border-white/10 hover:border-indigo-500/50 transition-all duration-300 cursor-pointer">
<div class="w-12 h-12 bg-gradient-to-r from-indigo-500 to-purple-600 rounded-xl mb-4 flex items-center justify-center">
<i data-feather="cpu" class="w-6 h-6 text-white"></i>
</div>
<h3 class="text-xl font-bold mb-2">Advanced I/O</h3>
<p class="text-gray-400 text-sm">shiftOut(), pulseIn(), tone(), noTone()</p>
</div>
<div class="bg-gray-800/50 backdrop-blur-sm rounded-2xl p-6 border border-white/10 hover:border-pink-500/50 transition-all duration-300 cursor-pointer">
<div class="w-12 h-12 bg-gradient-to-r from-pink-500 to-orange-600 rounded-xl mb-4 flex items-center justify-center">
<i data-feather="wifi" class="w-6 h-6 text-white"></i>
</div>
<h3 class="text-xl font-bold mb-2">WiFi & IoT</h3>
<p class="text-gray-400 text-sm">WiFi library, ESP8266, ESP32 functions</p>
</div>
<div class="bg-gray-800/50 backdrop-blur-sm rounded-2xl p-6 border border-white/10 hover:border-cyan-500/50 transition-all duration-300 cursor-pointer">
<div class="w-12 h-12 bg-gradient-to-r from-cyan-500 to-teal-600 rounded-xl mb-4 flex items-center justify-center">
<i data-feather="server" class="w-6 h-6 text-white"></i>
</div>
<h3 class="text-xl font-bold mb-2">I2C & SPI</h3>
<p class="text-gray-400 text-sm">Wire library, SPI communication protocols</p>
</div>
<div class="bg-gray-800/50 backdrop-blur-sm rounded-2xl p-6 border border-white/10 hover:border-red-500/50 transition-all duration-300 cursor-pointer">
<div class="w-12 h-12 bg-gradient-to-r from-red-500 to-pink-600 rounded-xl mb-4 flex items-center justify-center">
<i data-feather="file-text" class="w-6 h-6 text-white"></i>
</div>
<h3 class="text-xl font-bold mb-2">Libraries</h3>
<p class="text-gray-400 text-sm">Built-in and contributed libraries</p>
</div>
</div>
<!-- Most Popular Functions -->
<div class="mb-16">
<h2 class="text-3xl font-bold mb-8 text-center">Most Popular Functions</h2>
<div class="grid gap-6">
<!-- pinMode() -->
<div class="bg-gray-800/30 backdrop-blur-sm rounded-2xl p-8 border border-white/10 hover:border-cyan-500/30 transition-all duration-300">
<div class="flex justify-between items-start mb-4">
<h3 class="text-2xl font-bold text-cyan-400">pinMode()</h3>
<span class="px-3 py-1 bg-cyan-500/20 text-cyan-400 rounded-full text-sm">Digital I/O</span>
</div>
<p class="text-gray-300 mb-6">Configures the specified pin to behave either as an input or an output.</p>
<div class="grid md:grid-cols-2 gap-6">
<div>
<h4 class="text-lg font-semibold mb-2 text-white">Syntax</h4>
<div class="bg-gray-900 rounded-lg p-3 mb-4">
<code class="text-cyan-400">pinMode(pin, mode)</code>
</div>
</div>
<div>
<h4 class="text-lg font-semibold mb-2 text-white">Parameters</h4>
<ul class="text-gray-400 space-y-1">
<li><code class="text-cyan-400">pin</code>: the Arduino pin number</li>
<li><code class="text-cyan-400">mode</code>: INPUT, OUTPUT, or INPUT_PULLUP</li>
</ul>
</div>
</div>
<h4 class="text-lg font-semibold mb-2 text-white">Example</h4>
<div class="bg-gray-900 rounded-lg p-4">
<pre class="text-gray-300 text-sm"><code>void setup() {
pinMode(LED_BUILTIN, OUTPUT); // sets the digital pin 13 as output
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turns the LED on
delay(1000); // waits for 1 second
digitalWrite(LED_BUILTIN, LOW); // turns the LED off
delay(1000); // waits for 1 second
}</code></pre>
</div>
<div class="mt-4 flex gap-2">
<button class="px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg text-sm transition-colors">
<i data-feather="copy" class="w-4 h-4 inline mr-1"></i> Copy
</button>
<button class="px-4 py-2 bg-cyan-600 hover:bg-cyan-500 rounded-lg text-sm transition-colors">
<i data-feather="play" class="w-4 h-4 inline mr-1"></i> Try it
</button>
</div>
</div>
<!-- digitalWrite() -->
<div class="bg-gray-800/30 backdrop-blur-sm rounded-2xl p-8 border border-white/10 hover:border-purple-500/30 transition-all duration-300">
<div class="flex justify-between items-start mb-4">
<h3 class="text-2xl font-bold text-purple-400">digitalWrite()</h3>
<span class="px-3 py-1 bg-purple-500/20 text-purple-400 rounded-full text-sm">Digital I/O</span>
</div>
<p class="text-gray-300 mb-6">Write a HIGH or LOW value to a digital pin.</p>
<div class="grid md:grid-cols-2 gap-6">
<div>
<h4 class="text-lg font-semibold mb-2 text-white">Syntax</h4>
<div class="bg-gray-900 rounded-lg p-3 mb-4">
<code class="text-purple-400">digitalWrite(pin, value)</code>
</div>
</div>
<div>
<h4 class="text-lg font-semibold mb-2 text-white">Parameters</h4>
<ul class="text-gray-400 space-y-1">
<li><code class="text-purple-400">pin</code>: the Arduino pin number</li>
<li><code class="text-purple-400">value</code>: HIGH or LOW</li>
</ul>
</div>
</div>
<h4 class="text-lg font-semibold mb-2 text-white">Example</h4>
<div class="bg-gray-900 rounded-lg p-4">
<pre class="text-gray-300 text-sm"><code>int ledPin = 13; // LED connected to digital pin 13
void setup() {
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
void loop() {
digitalWrite(ledPin, HIGH); // sets the LED on
delay(1000); // waits for a second
digitalWrite(ledPin, LOW); // sets the LED off
delay(1000); // waits for a second
}</code></pre>
</div>
<div class="mt-4 flex gap-2">
<button class="px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg text-sm transition-colors">
<i data-feather="copy" class="w-4 h-4 inline mr-1"></i> Copy
</button>
<button class="px-4 py-2 bg-purple-600 hover:bg-purple-500 rounded-lg text-sm transition-colors">
<i data-feather="play" class="w-4 h-4 inline mr-1"></i> Try it
</button>
</div>
</div>
<!-- analogRead() -->
<div class="bg-gray-800/30 backdrop-blur-sm rounded-2xl p-8 border border-white/10 hover:border-green-500/30 transition-all duration-300">
<div class="flex justify-between items-start mb-4">
<h3 class="text-2xl font-bold text-green-400">analogRead()</h3>
<span class="px-3 py-1 bg-green-500/20 text-green-400 rounded-full text-sm">Analog I/O</span>
</div>
<p class="text-gray-300 mb-6">Reads the value from the specified analog pin. Arduino boards contain a multichannel, 10-bit analog to digital converter.</p>
<div class="grid md:grid-cols-2 gap-6">
<div>
<h4 class="text-lg font-semibold mb-2 text-white">Syntax</h4>
<div class="bg-gray-900 rounded-lg p-3 mb-4">
<code class="text-green-400">analogRead(pin)</code>
</div>
</div>
<div>
<h4 class="text-lg font-semibold mb-2 text-white">Parameters</h4>
<ul class="text-gray-400 space-y-1">
<li><code class="text-green-400">pin</code>: the analog input pin number</li>
</ul>
</div>
</div>
<h4 class="text-lg font-semibold mb-2 text-white">Example</h4>
<div class="bg-gray-900 rounded-lg p-4">
<pre class="text-gray-300 text-sm"><code>int analogPin = A3; // potentiometer wiper (middle terminal) connected to analog pin 3
// outside leads to ground and +5V
int val = 0; // variable to store the value read
void setup() {
Serial.begin(9600); // setup serial
}
void loop() {
val = analogRead(analogPin); // read the input pin
Serial.println(val); // debug value
}</code></pre>
</div>
<div class="mt-4 flex gap-2">
<button class="px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg text-sm transition-colors">
<i data-feather="copy" class="w-4 h-4 inline mr-1"></i> Copy
</button>
<button class="px-4 py-2 bg-green-600 hover:bg-green-500 rounded-lg text-sm transition-colors">
<i data-feather="play" class="w-4 h-4 inline mr-1"></i> Try it
</button>
</div>
</div>
</div>
</div>
<!-- Back to Home -->
<div class="text-center">
<a href="/" class="inline-flex items-center gap-2 text-cyan-400 hover:text-cyan-300 transition-colors">
<i data-feather="arrow-left" class="w-5 h-5"></i>
Back to Home
</a>
</div>
</div>
</section>
<!-- Footer -->
<doc-footer></doc-footer>
<script src="components/navbar.js"></script>
<script src="components/footer.js"></script>
<script src="script.js"></script>
<script>feather.replace();</script>
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
</body>
</html> |