This file contains 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
a = 1 | |
thread_a_preempted_count = 0 | |
thread_b_preempted_count = 0 | |
t1 = Thread.new do | |
10000000.times do|i| | |
if (a != 1) | |
thread_a_preempted_count += 1 | |
end |
This file contains 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
# Cross Compiling configuration for Intel Galileo on Arduino environment | |
# http://arduino.cc/en/ArduinoCertified/IntelGalileo | |
# | |
# Requires Arduino IDE for Intel Galileo | |
MRuby::CrossBuild.new("Galileo") do |conf| | |
toolchain :gcc | |
# Mac OS X | |
# Assume you renamed Arduino.app to Arduino_Galileo.app |
This file contains 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
コメントに説明を書きました。 |
This file contains 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
MRuby::CrossBuild.new("STM32F4") do |conf| | |
toolchain :gcc | |
ARM_TOOLCHAIN_PATH = "/Applications/MapleIDE.app/Contents/Resources/Java/hardware/tools/arm/bin" | |
LIBMAPLE_PATH = "/Users/koji/tools/AeroQuad/Libmaple/libmaple" | |
conf.cc do |cc| | |
cc.command = "#{ARM_TOOLCHAIN_PATH}/arm-none-eabi-gcc" | |
cc.include_paths << ["#{LIBMAPLE_PATH}/libmaple", |
This file contains 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
MRuby::CrossBuild.new("Arduino Due") do |conf| | |
toolchain :gcc | |
# Mac OS X | |
ARDUINO_PATH = '/Applications/Arduino.app/Contents/Resources/Java' | |
# GNU Linux | |
#ARDUINO_PATH = '/opt/arduino' | |
BIN_PATH = "#{ARDUINO_PATH}/hardware/tools/g++_arm_none_eabi/bin" | |
SAM_PATH = "#{ARDUINO_PATH}/hardware/arduino/sam" | |
TARGET_PATH = "#{SAM_PATH}/variants/arduino_due_x" |
This file contains 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
MRuby::CrossBuild.new("STM32F4") do |conf| | |
toolchain :gcc | |
ARM_TOOLCHAIN_PATH = "/Applications/MapleIDE.app/Contents/Resources/Java/hardware/tools/arm/bin" | |
LIBMAPLE_PATH = "/Users/koji/tools/AeroQuad/Libmaple/libmaple" | |
conf.cc do |cc| | |
cc.command = "#{ARM_TOOLCHAIN_PATH}/arm-none-eabi-gcc" | |
cc.include_paths << ["#{LIBMAPLE_PATH}/libmaple", |
This file contains 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
[koji@macbookpro:~/work/mruby]$ cat block_comment.rb | |
puts "hello" | |
=begin | |
here is a comment | |
=end | |
puts "bye" | |
[koji@macbookpro:~/work/mruby]$ ruby block_comment.rb | |
hello |
This file contains 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
#if defined(ARDUINO) && (ARDUINO==153) | |
#include <Wire.h> | |
#endif | |
#include <Servo.h> | |
#ifdef MPIDE | |
#else | |
#include <Arduino.h> | |
#endif |
This file contains 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
package main | |
/* | |
#cgo CFLAGS: -I/Users/koji/work/mruby/mruby/include | |
#cgo LDFLAGS: libmyclib.a -lreadline /Users/koji/work/mruby/mruby/build/host/lib/libmruby.a | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include "myclib.h" | |
#include <readline/readline.h> | |
#include <readline/history.h> |
This file contains 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 <Servo.h> | |
Servo servo; | |
unsigned long start_ms; | |
void moveServo(){ | |
//attach/detach each time to avoid servo noise. | |
servo.attach(10); |
OlderNewer