This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
void setup() | |
{ | |
Wire.begin(); | |
Serial.begin(115200); | |
Serial.println("\nI2C Scanner"); | |
} | |
void loop() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
void print_to_screen(const char* char_array) { std::cout << char_array << '\n'; } | |
int main() { | |
std::string std_str{"Hello, World!\n"}; | |
const char* char_array{std_str.c_str()}; | |
print_to_screen(char_array); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int main() { | |
// Optimizes for speed over memory use. | |
// On modern machines, int_fast16_t will often instead be 32-bit, consuming 4 bytes like | |
// int_fast32_t. This is actually better for performance. | |
std::cout << sizeof(int_fast16_t) << '\n'; | |
std::cout << sizeof(int_fast32_t) << '\n'; | |
std::cout << sizeof(int_fast64_t) << '\n'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/pwsh-preview | |
# Setting default values for some variables | |
$configVersion = "" | |
$preferredCompiler = "" | |
$cppStandard = "" | |
$additionalFlags = "" | |
$currentDir = (Get-Item -Path ".\").FullName | |
$configPath = "$currentDir/cpp_config.xml" | |
$PSVersion = "PowerShell " + $PSVersionTable.PSEdition + " version: " + $PSVersionTable.PSVersion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
enum class Operation { Add, Subtract, Multiply, Divide }; | |
struct Calculator { | |
Operation op; | |
Calculator(Operation operation) { op = operation; } | |
int calculate(int a, int b) { | |
switch (op) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
using string = std::string; | |
struct Example { | |
public: | |
// Default constructor | |
Example() { std::cout << "Created Entity!\n"; }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
struct Superclass { | |
int x{}; | |
}; | |
struct Subclass : public Superclass { | |
public: | |
int y{}; | |
int foo() { return x + y; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
using string = std::string; | |
struct Entity { | |
Entity() { m_Name = "Unknown"; } | |
Entity(const string& name) { m_Name = name; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <WiFi.h> | |
#include "time.h" | |
const char* ssid = "SSID"; | |
const char* password = "password"; | |
const char* ntpServer = "pool.ntp.org"; | |
// Default time from NTP is GMT. Replace with your timezone offset. Expected to be measured in seconds. | |
// 3600 seconds in 1 hour. CDT is 5 hours behind GMT. 3600 * 5 = 18,000. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ARC environment | |
#import <stdio.h> | |
int main( int argc, const char *argv[] ) { | |
@autoreleasepool { | |
// Code benefitting from a local autorelease pool. | |
NSLog(@"Hello, World!"); | |
} | |
} |