본문 바로가기

Programing

LED 깜빡이기 123456789101112131415161718#include #include #include "nrf_delay.h"#include "nrf_gpio.h"#include "boards.h" int main(void) { // Configure LED-pins as outputs. nrf_gpio_cfg_output(LED_1); // Toggle LEDs. while (true) { nrf_gpio_pin_set(LED_1); nrf_delay_ms(500); nrf_gpio_pin_clear(LED_1); nrf_delay_ms(500); }}Colored by Color Scriptercs
타이머 인터럽트 예제 blinky_rtx_pca10028을 이용해서 변경한것입니다.rtx는 CMSIS-RTOS를 나타낸다고합니다.1234567891011121314151617181920212223242526272829303132#include #include #include "nrf_gpio.h"#include "bsp.h"#include "cmsis_os.h" //인터럽트 인터벌#define LED_1_INTERVAL 100 void timer1_handler(void const * arg) { //타이머 인터럽트가 발생할때 해야할 일 nrf_gpio_pin_toggle(LED_1);} //타이머 콜백 함수osTimerDef(led_toggle_timer1, timer1_handler); int main(void) {..
Nordic에서 나온 nRF51422 & nRF51822 BLE를 사용해보려고 Nordic에서 나온 nRF51422와 nRF51822 개발 보드를 구입했습니다.nRF51422를 기준으로 글이 작성될것입니다.만날 PIC만하다가 다른 칩을 사용하려니 어럽네요.개발 환경 구성하는것은 다른분들고 많이 작성해 주셔서 따로 포스팅 할지는 모르겠습니다.
C언어에서 반올림 함수 C언어는 표준 라이브러리에 반올림 함수가 없습니다.(혹시 있다면 알려주세요 글 수정하겠습니다.) 때문에 반올림 함수를 만들어 사용하여야 되는데 간단하게 반올림 함수를 만들수 있습니다.ceil : 올림 함수floor : 버림 함수위 두 함수를 이용하여 간단하게 만들 수 있습니다.ceil(x - 0.5);floor(x+0.5); 1.4와 1.6으로 예를 들면ceil(1.4-0.5) = ceil(0.9) = 1 ceil(1.6-0.5) = ceil(1.1) = 2floor(1.4+0.5) = floor(1.9) = 1floor(1.6+0.5) = floor(2.1) = 2위와 같이 반올림 되는것을 확인할 수 있습니다.
FFT C code Colored By Color Scripter™1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677/* Modification of Paul Bourkes FFT code by Peter Cusack to utilise the Microsoft complex type. This computes an in-place complex-to-complex FFT x and y are the real and imaginary arrays of 2^m points. dir = 1 gives forward tra..
[C#]더블버퍼 Bitmap bitmap = new Bitmap(500,400);Graphics G = Graphics.FromImage(bitmap);Graphics BG = pictureBox1.CreateGraphics(); BG.DrawImage(bitmap, 0, 0);
[C#]Draw관련 C#에서 Paint 이벤트에서 Draw를 할려면 e.Graphics.DrawXXX 일런 식으로 가능하지만 Paint 이벤트 왜에서 Draw하려면Graphics G = pictureBox1.CreateGraphics();G.DrawXXX이렇게 하면 pictureBox1에 Draw된다. pen 선언은 이렇게Pen pen = new Pen(Color.Black);
template 예제 #include #include using namespace std; /* template class MyClass { CoordType x, y; public: MyClass(CoordType i, CoordType j) { x = i; y = j; } void show() { cout