목록분류 전체보기 (351)
printf("ho_tari\n");
#include #include "rational.h" int main() { Rational r1(3,4); Rational r2(3); Rational r3; r3 = r1; if (r1 == r3) { std::cout den * rhs.den); result.num = (this->num * rhs.den - rhs.num * this->den)/gcd; result.den = (this->den * rhs.den)/gcd; return result; } Rational Rational::operator*(const Rational &rhs) { Rational result(this->num * rhs.num,this->den * rhs.den); int gcd = GCD(this->num * r..
#include #include "complex.h" int main() { Complex c1(3.0,4.0); // 3.0 + 4.0i Complex c2(3.0); // 3.0 + 0i Complex c3; // 0 + 0i //c3.real(c1.real()); //c3.imag(c1.imag()); c3 = c1; c2 = c1-c3; if (c1 == c3) { std::cout real()-rhs.re, this->imag()-rhs.im); return result; }
#include Servo myservo; #define ir_enter 2 #define ir_back 3 #define ir_car1 5 #define ir_car2 6 #define ir_car3 7 #define ir_car4 8 #define redPin1 9 #define greenPin1 10 #define bluePin1 A3 #define redPin2 11 #define greenPin2 12 #define bluePin2 A3 #define redPin3 13 #define greenPin3 A0 #define bluePin3 A3 #define redPin4 A2 #define greenPin4 A1 #define bluePin4 A3 #define buzzerPin A4 int f..
#include "PinChangeInterrupt.h" const int LED[6] = {8, 9, 10, 11, 12, 13}; const int SW_0 = 4; int cnt = 0; void SW_0_Pressed(void) { cnt++; } void setup() { // put your setup code here, to run once: for(int i = 0; i < 6; i++) { pinMode(LED[i], OUTPUT); } attachPCINT(digitalPinToPCINT(SW_0), SW_0_Pressed, RISING); } void loop() { // put your main code here, to run repeatedly: for(int i = 0; i < ..
#define STOP 0 #define CW 1 #define CCW 2 const int DC_E = 3; const int DC_P = 5; const int DC_N = 4; void setup() { // put your setup code here, to run once: pinMode(DC_E, OUTPUT); pinMode(DC_P, OUTPUT); pinMode(DC_N, OUTPUT); DC_MOTOR_cntl(CW, 1000); DC_MOTOR_cntl(STOP, 1000); DC_MOTOR_cntl(CCW, 1000); DC_MOTOR_cntl(STOP, 1000); } void loop() { // put your main code here, to run repeatedly: } ..
const int LED[6] = {3, 5, 6, 9, 10, 11}; int cnt = 0; void setup() { // put your setup code here, to run once: for(int i = 0; i < 6; i++) { pinMode(LED[i], OUTPUT); } } void loop() { // put your main code here, to run repeatedly: for(int i = 0; i < 6; i++) { digitalWrite(LED[i], cnt & (0x01
unsigned long t1_prev = 0; const unsigned long t1_delay = 1000; unsigned long t2_prev = 0; const unsigned long t2_delay = 500; void setup() { // put your setup code here, to run once: Serial.begin(115200); } void loop() { // put your main code here, to run repeatedly: unsigned long t1_now = millis(); if(t1_now - t1_prev >= t1_delay) { t1_prev = t1_now; Serial.println(" t1 "); } unsigned long t2_..